You can catch most opportunistic npm supply-chain worms without a network or account by statically parsing every package's install script, checking package names against a bundled corpus of known-malicious entries, and flagging any trusted package whose lifecycle script suddenly drifts from its known-good fingerprint. Static analysis will not run or sandbox the code, so treat it as defense-in-depth, not a guarantee.
Most supply-chain compromises do their damage in a package's lifecycle scripts
(preinstall, install, postinstall) — code that runs
automatically the moment you npm install, before you import anything. The
Shai-Hulud class of worm is the hard case: it doesn't ship as an obviously-bad new package,
it injects itself into the install script of a package you already trust, so a
blocklist of bad names never sees it.
acorn, the parser used by webpack, rollup, and eslint) finds eval/new Function, dynamic require()/import(), network builtins, child_process use, and process.env reads in install scripts.require('ht' + 'tps') and base64-encoded secret paths.postinstall work doesn't drown the report, and any unexpected change to a trusted script is flagged as critical. This is the Shai-Hulud tell.
It is not a sandbox and does not block npm install — pair it with
npm's ignore-scripts or an allow-list tool to actually prevent
execution. It is not a CVE scanner — use osv-scanner or npm audit for
known vulnerable versions. And it cannot deobfuscate arbitrary JavaScript. Its value is being
small, auditable, deterministic, and runnable anywhere.