Crypto scam investigations and install-time security. Merged contributions to OWASP Cheat Sheets, SEAL Frameworks and lockfile-lint. Free: scam detector, npm-install-audit. They steal. We expose.
Good to see it run instead of argued. One row I'd add to that table: git dependencies. Their lockfile entry has a resolved URL with the commit hash and no integrity field at all, because npm clones the repo and packs it itself (running the dep's prepare on the way). So the source commit is pinned, but the bytes that end up in node_modules are not checked against anything.
The other quiet one is the resolved field itself. If a PR edits a resolved URL to point at another host and updates the integrity to match, npm ci installs it without complaint, since the lockfile is the thing it trusts. That is the case lockfile-lint's allowed hosts check is there for.
I measure AI coding claims in public. LGTM — Let's Get the Measurements: real runs, real numbers, receipts. Every article is an experiment I actually ran. Books & packs: aheadkit.gumroad.com
That's a row the table is missing, and it's a good one. The git dep case is the quiet hole, pinned commit but nothing checking the bytes that actually land. I'll run that one, a git dep in the lockfile, then a swapped resolved URL, and see whether npm ci complains at all, plus whether lockfile-lint's allowed-hosts check catches it. Did you hit this one in a real repo, or spot it reading the lockfile?
Crypto scam investigations and install-time security. Merged contributions to OWASP Cheat Sheets, SEAL Frameworks and lockfile-lint. Free: scam detector, npm-install-audit. They steal. We expose.
Spotted it while testing, not in a real repo. We set up a local git dependency to check whether --ignore-scripts stops its prepare script on npm 10 (it doesn't), and the lockfile entry had the commit hash in resolved and no integrity field at all. So for a git dep the commit is the only pin. Curious what npm ci does with the swapped URL, please share when you run it.
I measure AI coding claims in public. LGTM — Let's Get the Measurements: real runs, real numbers, receipts. Every article is an experiment I actually ran. Books & packs: aheadkit.gumroad.com
Ran it. The swap doesn't do what the question assumed — npm ignores the lockfile's resolved URL and re-resolves from package.json, so swapping the lockfile alone still installs A without a word. The one that works is the full swap, both files to repo B with its own commit, and that one installs silently and runs prepare. lockfile-lint passes the tampered file either way. Does that make the lockfile row dead weight for git deps in your setup, or do you still keep it as the record?
Crypto scam investigations and install-time security. Merged contributions to OWASP Cheat Sheets, SEAL Frameworks and lockfile-lint. Free: scam detector, npm-install-audit. They steal. We expose.
We keep it as the record. It's the only place the resolved commit is written down, so a diff there is still worth a look in review. But for git deps the pin that decides what gets installed is the line in package.json, so that's the one we treat as the control.
I measure AI coding claims in public. LGTM — Let's Get the Measurements: real runs, real numbers, receipts. Every article is an experiment I actually ran. Books & packs: aheadkit.gumroad.com
Record versus control is the clean way to put it — the lockfile row is still worth eyeballing in review, but the line that decides the install lives in package.json. That answers my question better than I expected. Does the resolved diff get a look on every PR, or only when package.json moves too?
Good distinction. One thing that bit us: the hashes in the lockfile only help if the install step refuses to deviate from it. In CI that means npm ci rather than npm install, --frozen-lockfile for yarn/pnpm, and --require-hashes for pip. Otherwise a resolver can quietly rewrite the lockfile and the check never runs. In PR review, I also watch for lockfile diffs where the resolved URL changes host or registry even though the version stays the same. That is usually the most suspicious line in the diff. And the committed lockfile is the best record of what actually shipped, so it's worth keeping when you later need to answer "were we affected?"
I measure AI coding claims in public. LGTM — Let's Get the Measurements: real runs, real numbers, receipts. Every article is an experiment I actually ran. Books & packs: aheadkit.gumroad.com
the resolved URL changing host while the version stays put, that's the line I'd miss in review too. version looks boring so your eyes slide right past it. the install-step point is the real one though, a lockfile nobody enforces is just a suggestion. do you actually catch those host swaps in review, or is it the kind of thing you only spot after something's gone wrong?
Really glad you ran this instead of just arguing it — the table makes the point better than any explanation could. The row that surprised me was the second one: I also assumed plain npm install would quietly rewrite the lockfile to the new hash, but it refused with EINTEGRITY instead. That changes how I think about it: the lockfile is not just a record of what I installed, it's the thing that actually stops a swapped tarball from landing. Your point about deleting the lockfile is the one I'll remember — one rm and the same install takes the new bytes without a word. We write phone-fix guides at TechFixNest, so this maps to something I tell readers often: the boring safety check (here, keeping the lockfile committed and eyeballing lockfile diffs in a PR) is what catches the problem that the version number hides. Thanks for publishing the real runs, Salam.
I measure AI coding claims in public. LGTM — Let's Get the Measurements: real runs, real numbers, receipts. Every article is an experiment I actually ran. Books & packs: aheadkit.gumroad.com
The EINTEGRITY row surprised me too — I went in expecting npm to quietly rewrite the lockfile and it just refused. The rm point is the one that stuck with me as well, one command and the safety net is gone. Do your phone-fix guides have a check like that, the boring one everyone nods at and skips?
We're a place where coders share, stay up-to-date and grow their careers.
Good to see it run instead of argued. One row I'd add to that table: git dependencies. Their lockfile entry has a resolved URL with the commit hash and no integrity field at all, because npm clones the repo and packs it itself (running the dep's prepare on the way). So the source commit is pinned, but the bytes that end up in node_modules are not checked against anything.
The other quiet one is the resolved field itself. If a PR edits a resolved URL to point at another host and updates the integrity to match, npm ci installs it without complaint, since the lockfile is the thing it trusts. That is the case lockfile-lint's allowed hosts check is there for.
That's a row the table is missing, and it's a good one. The git dep case is the quiet hole, pinned commit but nothing checking the bytes that actually land. I'll run that one, a git dep in the lockfile, then a swapped resolved URL, and see whether npm ci complains at all, plus whether lockfile-lint's allowed-hosts check catches it. Did you hit this one in a real repo, or spot it reading the lockfile?
Spotted it while testing, not in a real repo. We set up a local git dependency to check whether --ignore-scripts stops its prepare script on npm 10 (it doesn't), and the lockfile entry had the commit hash in resolved and no integrity field at all. So for a git dep the commit is the only pin. Curious what npm ci does with the swapped URL, please share when you run it.
Ran it. The swap doesn't do what the question assumed — npm ignores the lockfile's resolved URL and re-resolves from package.json, so swapping the lockfile alone still installs A without a word. The one that works is the full swap, both files to repo B with its own commit, and that one installs silently and runs prepare. lockfile-lint passes the tampered file either way. Does that make the lockfile row dead weight for git deps in your setup, or do you still keep it as the record?
We keep it as the record. It's the only place the resolved commit is written down, so a diff there is still worth a look in review. But for git deps the pin that decides what gets installed is the line in package.json, so that's the one we treat as the control.
Record versus control is the clean way to put it — the lockfile row is still worth eyeballing in review, but the line that decides the install lives in package.json. That answers my question better than I expected. Does the resolved diff get a look on every PR, or only when package.json moves too?
Good distinction. One thing that bit us: the hashes in the lockfile only help if the install step refuses to deviate from it. In CI that means
npm cirather thannpm install,--frozen-lockfilefor yarn/pnpm, and--require-hashesfor pip. Otherwise a resolver can quietly rewrite the lockfile and the check never runs. In PR review, I also watch for lockfile diffs where the resolved URL changes host or registry even though the version stays the same. That is usually the most suspicious line in the diff. And the committed lockfile is the best record of what actually shipped, so it's worth keeping when you later need to answer "were we affected?"the resolved URL changing host while the version stays put, that's the line I'd miss in review too. version looks boring so your eyes slide right past it. the install-step point is the real one though, a lockfile nobody enforces is just a suggestion. do you actually catch those host swaps in review, or is it the kind of thing you only spot after something's gone wrong?
Really glad you ran this instead of just arguing it — the table makes the point better than any explanation could. The row that surprised me was the second one: I also assumed plain npm install would quietly rewrite the lockfile to the new hash, but it refused with EINTEGRITY instead. That changes how I think about it: the lockfile is not just a record of what I installed, it's the thing that actually stops a swapped tarball from landing. Your point about deleting the lockfile is the one I'll remember — one rm and the same install takes the new bytes without a word. We write phone-fix guides at TechFixNest, so this maps to something I tell readers often: the boring safety check (here, keeping the lockfile committed and eyeballing lockfile diffs in a PR) is what catches the problem that the version number hides. Thanks for publishing the real runs, Salam.
The EINTEGRITY row surprised me too — I went in expecting npm to quietly rewrite the lockfile and it just refused. The rm point is the one that stuck with me as well, one command and the safety net is gone. Do your phone-fix guides have a check like that, the boring one everyone nods at and skips?