No packages removed from the npm registry (unpublished)
Why it matters
Dependency confusion attacks work by registering a malicious package on the public npm registry using the same name as your private internal package. When npm resolves dependencies, it may fetch the public (attacker-controlled) version instead of your private one — silently installing code that exfiltrates credentials or establishes a backdoor. This attack class has compromised systems at Microsoft, Apple, PayPal, and dozens of other organizations. OWASP A08 (Software and Data Integrity Failures) and CWE-829 (Inclusion of Functionality from Untrusted Control Sphere) define the failure. SLSA L2 requires that every dependency be verifiable against a trusted source. An @yourcompany/internal-lib in package.json with no private registry configured in .npmrc is an open invitation for this exact attack.
Severity rationale
Critical because dependency confusion attacks have been executed successfully against major organizations and result in silent installation of attacker-controlled code on developer machines and CI systems.
Remediation
Scope all private packages under a unique organization namespace and configure .npmrc to route that scope exclusively to your private registry:
# .npmrc
@yourcompany:registry=https://your-private-registry.example.com
For each private package name, also publish a placeholder package on the public npm registry to claim the name and prevent an attacker from registering it. Use npm publish --access public with a package body that simply redirects to the private source or contains a security notice.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Dependency & Supply Chain Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-829 — Inclusion of Functionality from Untrusted Control Sphere
- cwe · CWE-1357 — Reliance on Insufficiently Trustworthy Component
- owasp:2021 · A08 — Software and Data Integrity Failures
- slsa:1.0 · L2 — Hosted build platform with signed provenance
- soc2:2017 · CC6.8 — Prevention and detection of unauthorized or malicious software
Taxons
History
- 2026-04-18·v1.0.0·Initial import from dependency-supply-chain·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (CC6.8) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2