The zero at the top of the tree matches what I've seen, and it's also where the check gets tricky in practice: npm view <pkg> scripts only tells you about the latest published version. A compromised release gets yanked and the tag moves on, so the tarball that ran a postinstall in your build last week is no longer the one you're querying. Scanning the actual resolutions in the lockfile (npm ls --all --json and reading each cached package's manifest) is the version that catches leaves rather than celebrities.
Worth adding to the post: npm ci --ignore-scripts is the blunt fix, but it silently skips the legitimate build step in native packages — better-sqlite3, sharp, esbuild's binary download — so people disable it once, break their build, and turn it back on permanently. The pattern I've had better luck with is allowlisting scripts per package (--ignore-scripts plus an explicit rebuild for the handful of native deps) rather than trusting the tree or disabling wholesale.
Did you sanity-check any of the 25 by actually installing with --foreground-scripts to see what npm does when there's nothing declared? Curious whether that path is as quiet as it should be.
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 yanked-release hole is real — my check was a snapshot of latest, so a bad version that got pulled would slip straight past it. The lockfile scan is the version that actually catches leaves. And no, I didn't run the --foreground-scripts check on any of the 25, so I can't tell you how quiet that path is. Fair question.
We investigate real crypto scams and build free tools: npm-install-audit (check a take-home repo before npm install), an AI scam detector, an open quiz and glossary. They steal. We expose.
Two things that make the zero less comforting in practice. First, if you set ignore-scripts=true in your user ~/.npmrc, a cloned repo's own .npmrc sits higher in npm's config order, so one line of ignore-scripts=false in that repo turns hooks back on. Passing --ignore-scripts on the command line is the version a repo can't override.
Second, this week's PolinRider releases had no install hooks at all: the loader ran when the entrypoint was imported. So the scripts check covers the install moment, and the first require() is a separate door.
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
Both fair. The piece leans on the CLI flag for exactly that reason, but I never spelled out why — a repo's own .npmrc outranks the user one, so ignore-scripts=true in ~/.npmrc is the weaker version. And the PolinRider point widens the whole thing: zero hooks at install says nothing about the first require. Did you spot the loader behaviour in the package itself or in a write-up?
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
Actually the .npmrc override is worth testing properly — going to run that one, repo config vs user config vs the flag, and write up what actually keeps the hook off.
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 slide deck line is the whole piece in one sentence, honestly. Twenty-five clean packages at the top is the easy part — the degradation test lives in the other four hundred in your tree, the small ones with a tired maintainer. That's the bit I didn't check, and the bit that'd actually bite.
We check MCP servers and websites from the outside, the way an AI agent sees them, and publish what we find with names and dates. Free tools at x1y1.co/tools.
The leaves are exactly where it showed up for MCP. In June, Amazon Inspector reported malicious npm packages named mcp-server-git, mcp-server-fetch and three similar names, claimed to catch npx calls from AI coding agents. The mcp-server-git one used a postinstall script to send the machine's hostname, working folder, platform and Node version to an outside server. Agent configs make it worse, because npx -y installs with no prompt and the agent starts it in the background, so nobody sees the install happen at all. npm has since replaced those five with security placeholders, but in 10,659 public MCP configs we checked, 13 still name one of them.
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 13 still naming them is the part that stuck with me — the packages are gone and replaced, and the configs still point at the names. That's the leaves problem in one number. The npx -y bit too: an install nobody sees happen is an install nobody audits.
I research AI tools, APIs & agents — comparing specs, pricing and real user reports — then publish honest rankings so you don't waste money. Research-first, never sponsored fluff.
The prepare distinction is the bit I'll actually remember — I'd always lumped it in with postinstall in my head, so learning npm only runs it on a git or local install, not the published tarball, reframes half the “suspicious scripts” I've skimmed past. The zero is reassuring at the top, but Max's point about the yanked-release hole sticks with me: latest is a snapshot, and the leaves are where the MCP packages showed up in June. I ran npm view on a couple of mine after reading this, and now I'm wondering how many people check the tree and never the leaves.
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 leaves thing is the part I keep coming back to too — checking the top 25 took ten minutes, the other four hundred in a real tree is the bit nobody wants to sit down with. If you ran npm view on a couple of yours already, you're ahead of most people. The yanked hole is the one I still don't have a clean answer for — latest looks clean right up until it isn't.
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 the whole trick, really — one command and you can see the door before you walk through it. The simplicity is the point; if checking took a scanner nobody would ever run it.
We're a place where coders share, stay up-to-date and grow their careers.
The zero at the top of the tree matches what I've seen, and it's also where the check gets tricky in practice:
npm view <pkg> scriptsonly tells you about the latest published version. A compromised release gets yanked and the tag moves on, so the tarball that ran a postinstall in your build last week is no longer the one you're querying. Scanning the actual resolutions in the lockfile (npm ls --all --jsonand reading each cached package's manifest) is the version that catches leaves rather than celebrities.Worth adding to the post:
npm ci --ignore-scriptsis the blunt fix, but it silently skips the legitimate build step in native packages — better-sqlite3, sharp, esbuild's binary download — so people disable it once, break their build, and turn it back on permanently. The pattern I've had better luck with is allowlisting scripts per package (--ignore-scriptsplus an explicit rebuild for the handful of native deps) rather than trusting the tree or disabling wholesale.Did you sanity-check any of the 25 by actually installing with
--foreground-scriptsto see what npm does when there's nothing declared? Curious whether that path is as quiet as it should be.The yanked-release hole is real — my check was a snapshot of latest, so a bad version that got pulled would slip straight past it. The lockfile scan is the version that actually catches leaves. And no, I didn't run the --foreground-scripts check on any of the 25, so I can't tell you how quiet that path is. Fair question.
Two things that make the zero less comforting in practice. First, if you set ignore-scripts=true in your user ~/.npmrc, a cloned repo's own .npmrc sits higher in npm's config order, so one line of ignore-scripts=false in that repo turns hooks back on. Passing --ignore-scripts on the command line is the version a repo can't override.
Second, this week's PolinRider releases had no install hooks at all: the loader ran when the entrypoint was imported. So the scripts check covers the install moment, and the first require() is a separate door.
Both fair. The piece leans on the CLI flag for exactly that reason, but I never spelled out why — a repo's own .npmrc outranks the user one, so ignore-scripts=true in ~/.npmrc is the weaker version. And the PolinRider point widens the whole thing: zero hooks at install says nothing about the first require. Did you spot the loader behaviour in the package itself or in a write-up?
Actually the .npmrc override is worth testing properly — going to run that one, repo config vs user config vs the flag, and write up what actually keeps the hook off.
Clean architecture is easy to maintain in a slide deck; the real test is how gracefully the system degrades under cascading production failures.
Minimizing abstraction layers and owning your critical runtime path will always outperform adding more third-party glue.
That slide deck line is the whole piece in one sentence, honestly. Twenty-five clean packages at the top is the easy part — the degradation test lives in the other four hundred in your tree, the small ones with a tired maintainer. That's the bit I didn't check, and the bit that'd actually bite.
The leaves are exactly where it showed up for MCP. In June, Amazon Inspector reported malicious npm packages named mcp-server-git, mcp-server-fetch and three similar names, claimed to catch npx calls from AI coding agents. The mcp-server-git one used a postinstall script to send the machine's hostname, working folder, platform and Node version to an outside server. Agent configs make it worse, because npx -y installs with no prompt and the agent starts it in the background, so nobody sees the install happen at all. npm has since replaced those five with security placeholders, but in 10,659 public MCP configs we checked, 13 still name one of them.
The 13 still naming them is the part that stuck with me — the packages are gone and replaced, and the configs still point at the names. That's the leaves problem in one number. The npx -y bit too: an install nobody sees happen is an install nobody audits.
The prepare distinction is the bit I'll actually remember — I'd always lumped it in with postinstall in my head, so learning npm only runs it on a git or local install, not the published tarball, reframes half the “suspicious scripts” I've skimmed past. The zero is reassuring at the top, but Max's point about the yanked-release hole sticks with me: latest is a snapshot, and the leaves are where the MCP packages showed up in June. I ran npm view on a couple of mine after reading this, and now I'm wondering how many people check the tree and never the leaves.
The leaves thing is the part I keep coming back to too — checking the top 25 took ten minutes, the other four hundred in a real tree is the bit nobody wants to sit down with. If you ran npm view on a couple of yours already, you're ahead of most people. The yanked hole is the one I still don't have a clean answer for — latest looks clean right up until it isn't.
The npm view scripts check is brilliantly simple.
That's the whole trick, really — one command and you can see the door before you walk through it. The simplicity is the point; if checking took a scanner nobody would ever run it.