Detecting a Credential Stealer in npm and pnpm Dependency Trees

A poisoned release can run code in your build before your first import ever loads. This walkthrough audits npm and pnpm dependency trees for install-time credential stealers: enumerate lifecycle hooks with npm query, trace which parent dragged a package in, treat pnpm's ignored build scripts warning as a triage queue, and shrink the blast radius by denying dependency script execution and removing long-lived cloud credentials from the build environment. The case study is the reported poisoned Microsoft Agent Framework release on PyPI, which matters for JavaScript because the failure mode is the same: install-time code execution inside a build environment that holds ambient cloud identity. Lockfile pinning stops drift, but it does not stop a maintainer publishing a tarball you then choose to install. The demo is defensive and lab-scoped, using a synthetic fixture that writes a timestamp file and nothing else. No working exploit, no real credentials. Full write-up: https://hackyjs.com/posts/detecting-a-credential-stealer-in-npm-and-pnpm-dependency-trees

supply-chain-securitynpmpnpmcredential-theftdependency-audit

Read the post →