chainsaw npm
Run npm through Chainsaw — refuse malicious/typosquatted packages at install time
Run npm through Chainsaw — refuse malicious/typosquatted packages at install time
chainsaw npm [args...]
Run npm with an install-time supply-chain check in front of it.
Chainsaw evaluates the packages npm would install, refuses on a hit, and
otherwise hands off to the real npm with your arguments untouched. Anything
that is not an install verb (npm build, npm run, …) delegates immediately.
Guarded: npm install, npm i, npm add, npm ci.
A bare npm install or npm ci (no named package) scans the whole
resolved lockfile.
Offline by default. The bundled checks — typosquat detection and a
known-malicious floor — run entirely on your machine and send nothing. For the
full OpenSSF malicious-packages feed, run the opt-in chainsaw guard update,
which is the only networked step. Set CHAINSAW_OFFLINE=1 to refuse network
access outright.
Fails open by default: when a signal cannot be evaluated, Chainsaw prints a
visible notice and lets the install proceed, so a thin feed never breaks your
build. See chainsaw guard coverage to make that fail closed instead.
Exit codes: 0 when the install proceeds (Chainsaw then returns the real tool’s own exit code), 1 when Chainsaw refuses.
--help and every other flag are forwarded to npm untouched, so
chainsaw npm --help shows npm’s help, not this text. Use
chainsaw help npm to see this page.
To make the check automatic, add the shell shims: eval "$(chainsaw guard init)".
Examples
# check one package, then install it
chainsaw npm install lodash
# refuses: typosquat of "lodash"
chainsaw npm install lodahs
# scans every entry in package-lock.json
chainsaw npm ci
# not an install verb — delegates straight to npm
chainsaw npm run build
Flags
This command forwards its arguments to the underlying tool unchanged, so it parses no flags of its own. Anything after the command name goes to the wrapped package manager verbatim.