Six installs, one marker, and npm 10 ignores the flag three times out of three. Plain install, flag on the command line, flag in .npmrc: the prepare step runs every time. On npm 11 the same three installs split cleanly, plain runs it, the flag stops it, both ways. That is the whole result, and it took a local registry, two git repos and a fresh cache per install to be sure of it.
cryptostrapon and sunnatulla_dev both measured the same thing before I did, and both were right. On npm 10, a git dependency's prepare step runs straight through --ignore-scripts. On npm 11, it doesn't.
The setup is a small project depending on a local git repo, repo A, whose prepare step writes a marker file containing PREPARE-A-RAN. The marker's presence in the installed package is the whole observable. Node v24.22.1, system npm 10.9.4, and npm 11.21.3 installed locally in the run folder, nothing touched globally. Every install ran with a fresh cache, so no step could pass on bytes left over from an earlier one. The two repos are the same fixtures as Friday's lockfile run, repo A at c48c5632d59d77c1a4c9f6e2a5511402af93c217, repo B at 7698c3015c5ee3c21c23dfe45a30a67e11e2a3b0.
| Install | npm | Marker prepare-ran.txt | Exit |
|---|---|---|---|
| plain | 10.9.4 | present | 0 |
--ignore-scripts | 10.9.4 | present | 0 |
.npmrc ignore-scripts=true | 10.9.4 | present | 0 |
| plain | 11.21.3 | present | 0 |
--ignore-scripts | 11.21.3 | absent | 0 |
.npmrc ignore-scripts=true | 11.21.3 | absent | 0 |
In every case the installed bytes were A, index.js exporting GIT-A-MARKER. Only the prepare run differs. On npm 10 the flag changes nothing for a git dependency, whether passed on the command line or set in .npmrc. On npm 11 it works exactly as documented, both ways. A plain install on 11 still runs prepare, and prints a new warning about one package having install steps not yet covered, while the step runs anyway.
The mechanism is in the bundled pacote, and it is a two-line difference. npm 10.9.4 bundles pacote 19.0.1; npm 11.21.3 bundles pacote 21.5.2. Both versions' Arborist passes the flag through to pacote. The difference is inside pacote's DirFetcher#prepareDir, the pack step a git dependency goes through after cloning. Pacote 19 runs prepare unconditionally, with no check on the flag anywhere in its code. Pacote 21 returns early when the flag is set, before running prepare. The flag was always plumbed through. Pacote only started honouring it for the git-dependency pack step in the 20/21 generation. That is the whole 10-versus-11 difference for this case.
So I tried the obvious fix: bump pacote inside npm 10. Copy the system npm 10 tree, 17 MB, swap its pacote 19 for the 21.5.2 from the local npm 11 install, and run the same installs from it. Both installs exit 1, silent, nothing installed, the process dying right after startup with no error line. The reason is plain once you try to load it: pacote 21 cannot even start in the npm 10 tree, Error: Cannot find module '@gar/promise-retry'. It needs a whole new generation of dependencies alongside it, @npmcli/git 7 against the 6.0.3 present, @npmcli/run-script 10 against 9.1.0, cacache 20 against 19.0.1, tar 7 against 6.2.1, ssri 13 against 12.0.0, plus the new @gar/promise-retry package, which does not exist in the npm 10 tree at all. Bumping pacote alone is not a runnable configuration, and transplanting the full dependency set would just rebuild npm 11's tree inside npm 10's shell, which answers nothing. That arm stops here.
The second half of the lead was the scanner check, and it is the worse result. Friday's run proved a full swap of both files installs the attacker's bytes silently. The tampered state here is the D1 variant: package.json points at repo B and its commit, while the lockfile still says repo A. lockfile-lint 5.1.1, allowed-hosts check, on that lockfile: exit 0, ✔ No issues detected. A file:// URL has no hostname for the check to compare, so it passes vacuously. Add --validate-https and it fails, exit 1, but on protocol, not on tampering, and the original lockfile fails identically, so the check still cannot tell tampered from original. It fails both or passes both. It never catches the swap.
npm audit never gets to look at it at all. In this environment the audit endpoint answers 403 Forbidden, policy denied, and npm audit exits 1 with no verdict on the lockfile, neither a flag nor a clean bill. Same endpoint, same block, not retried.
The claim, then: on npm 10, do not count on the flag for git dependencies, and do not count on a scanner to catch the stale record either. The flag is ignored for the one dependency type where the prepare step actually runs, and the lockfile check passes a file:// URL without ever looking at the host, because there is no host to look at. The defence is the same as Friday's: the review. A pull request that touches a git URL or a commit hash in package.json deserves the same look as one that touches a version number, because that line is the pin, and on npm 10 nothing else is watching it.
Two limits. The npm 10 tested is 10.9.4 against the commenters' 10.9.9, and the behaviour matches their report exactly, with the mechanism not depending on the patch version. And only git+file:// dependencies were tested; a git+https:// dependency goes through the same pacote code path, but that was not run here.
Has a flag ever silently not applied to the one case where it mattered for you? What caught it, the docs, a test, or something breaking in production?
The full numbers behind this one are in the AheadKit guides. Everything I write here stays free, that part doesn't change. — Salam
More from AheadKit: programming books, packs and AI tools. Each page lists exactly what's inside before you pay.
