Malware found on NPM infecting local package with reverse shell
Package Repositories and Review Models
- Older ecosystems often had human “maintainers” vetting packages; most modern language registries (npm, PyPI, RubyGems, Go, etc.) largely don’t.
- A few exceptions with more review: Maven/Sonatype (automated), OCaml’s opam (manual but small-scale), Nixpkgs (PR review of build recipes), conda-forge.
- Several commenters note this manual model does not scale to today’s volume unless funded; the default has become “painless but unvetted.”
- Some organizations solve this with internal, reviewed package mirrors or in-house package managers.
Why NPM and JS See So Many Incidents
- Huge ecosystem, low publishing friction, and extreme dependency fan-out (micro-packages like trivial utilities) increase attack surface.
- Java, .NET, Python have richer standard libraries and cultural pressure to limit dependencies, so fewer tiny packages.
- Similar supply-chain issues exist in other ecosystems (PyPI, RubyGems, even Maven), but npm is the “canary” due to scale and velocity.
Mitigations in the JS Ecosystem
- Disabling or restricting
postinstallscripts (pnpm, Bun, and some npm/yarn modes) is seen as an important hardening step. - Tools mentioned:
- Sandboxing / permission systems (Deno, LavaMoat, “safe npm”).
- Behavior-based scanners and “assured”/scanned repos (Google’s assured OSS, Artifactory, Socket, others).
- Vendoring and tarring dependencies, zero-install approaches, fat JAR / Docker image style distribution.
- Some argue
ignore-scriptsonly blocks install-time attacks; runtime backdoors remain.
Sandboxing, Containers, and Security Boundaries
- Suggestion: always run npm (and builds) inside Docker/VMs.
- Disagreement: some say “Docker is not a security boundary” and may create false confidence; others counter that it still meaningfully raises the bar versus none.
- Practical constraints: on many corporate desktops, developers lack virtualization privileges.
Ecosystem & Security Trade-offs
- Calls to expand JS stdlib and browser/Node APIs (as in Deno/Bun) to reduce dependency sprawl.
- Critique of “wild west” open source: Linus’s Law fails when almost no one actually reviews code, especially transitive deps.
- Proposals: community review pools, distributed review tooling (e.g., cargo-vet/crev analogues), and more deterministic, offlineable builds.
Automation and AI
- Some advocate AI-based code scanning and even AI “watchers” during development.
- Others are skeptical, joking about buzzwords or cautioning that automated static scanning alone is easily evaded and often overhyped.