Most developers have typed npm install --save-dev so many times they no longer see it. That's the problem.
Leave off the two dashes, and npm doesn't stop you. It doesn't ask what you meant. It treats save-dev as the name of a package, pulls it from the public registry, and adds it to your package.json.
"Without the two dashes, npm reads the flag as a package name and downloads it with no warning," said Yuval Saggie, Security Researcher at Echo.
Echo, a software supply chain security company, set out to measure how big that gap is. The answer: 79 of npm's own flag names were sitting unclaimed on the registry, free for anyone to register. I asked Saggie how they found them, whether attackers have used the trick, and what teams should check today.
The typo npm won't catch
The risk is highest on npm install and its aliases (i, add, update, link), and on npx, npm exec, and npm init.
Here's Saggie's example. The command you meant:
npm install --save-dev webpack-cli
The command you typed:
npm install save-dev webpack-cli
The second one still installs webpack-cli. It also installs a package named "save-dev" and records it in package.json. Nothing fails, so nothing looks wrong.
Whoever owns that package name decides what lands in your node_modules. npm packages can run lifecycle scripts at install time, and npx and npm exec run a package directly. So a missing pair of dashes can become someone else's code running on your machine, or on your build server.
191 flags, 79 open names
There's an easy misreading of this research, and Saggie corrected it. Echo didn't find 79 typos in the wild. "We pulled all 191 flag names from npm's own source code, tried to register each one, and secured the 79 that were still free," he said.
Echo now holds those names, so no one else can publish under them. Echo’s full write-up of the research is here: npm Flag Typosquatting: How Missing Dashes Install Malware.
The typos are a separate finding. A scan of GitHub turned up 55 verified cases of developers leaving off the dashes. Most were in documentation and READMEs. Those matter because developers copy and paste install commands from READMEs every day.
But 10 were in files that actually run: build scripts, Makefiles, Dockerfiles, and CI workflows.
Known trick, no known attack
I asked whether attackers have already used this. "Not yet," Saggie said. But the idea isn't new. npm itself holds "save-dev" as an empty security placeholder. And other researchers claimed versions of some flag names in 2022 and 2024.
That placeholder tells you how often the mistake happens. The empty "save-dev" package still gets about 19,846 downloads a week. Every one of those is someone, or something, running an install command that didn't say what it meant to say.
"It's a potential exploit we were able to block, before the damage happened," Saggie said.
Why build pipelines raise the stakes
A typo in a terminal hits one developer once. A typo in a build file runs every time the pipeline does.
"Build systems run install commands automatically, often with cloud credentials loaded and no one reading the output," Saggie said. "A typo in a build file runs on every build; one Makefile we found has installed 'save-dev' on every run for years without failing."
That's the part that should bother platform teams. The build passed for years. No alert, no failed job, no reason to look. If a malicious package had owned that name, it would have run in an environment holding cloud credentials, on every build.
AI coding agents add a new version of the same problem. "AI coding agents that run install commands unattended carry the same risk," Saggie said. An agent that writes and runs npm install lines, often copied from docs it found, won't notice a missing dash any more than a tired developer would. And there's usually no one reading the output.
What to check now
Saggie's advice is simple. Search your repos, Dockerfiles, and CI files for npm install, add, exec, and npx lines where a flag word appears without its leading dashes. Then check package.json for dependencies with flag-style names like "save-dev."
A rough starting point:
grep -rnE '(npm (install|i|add|update|link|exec|init)|npx)\b.*[[:space:]](save-dev|save-exact|save-optional|save-peer|save-prod|no-save|global|force|legacy-peer-deps|production)\b' \
--include='*.sh' --include='Makefile' --include='Dockerfile*' --include='*.yml' --include='*.yaml' --include='*.json' --include='*.md' .
That list covers only a handful of common flags. npm has nearly 200, so treat it as a first pass, not a full audit. Checking the dependency names in package.json and your lockfile against npm's flag list is the more complete test.
Locked today, open tomorrow
Does GitHub locking the 79 names close the problem? Not for good, Saggie said.
"Locking the 79 names fixes the problem for now, and it draws attention to a risk that security teams should add to their checks and tests, but it doesn't close the problem," he said. "Every npm release adds new flags, each one a new unclaimed name; npm 12 alone added 11."
That's the real lesson. A one-time lockdown covers the flags that exist today. It can't cover the ones that ship next quarter. This belongs in CI as a standing check, alongside your other dependency rules.
Test the vendor, including this one
I asked Saggie which supply chain claims teams should doubt, and how they'd test a vendor, Echo included.
His answer was practical. "The best way to test a supply-chain vendor is to scan their software artifacts for vulnerabilities and measure how quickly they respond to a supply chain attack," he said. Then check whether they meet the response times the AI era requires.
And he'd be skeptical of one label in particular. "Teams should be skeptical of claims to be AI-first or AI-native, because those claims mean little if the vendor can't deliver."
My take
This isn't a sophisticated attack. That's why it's worth your attention.
There's no zero-day here and no compromised maintainer. There's a parser doing exactly what it was built to do, and a human, or an agent, typing slightly less than they meant. The defense is just as plain: know what your install commands say, check what landed in package.json, and keep checking as npm adds new flags.
The build that has quietly installed "save-dev" for years is the one to look for. It's probably not the only one.