npm supply chain in 2026 — one of the top-3 attack surfaces. The 2024 xz backdoor + 2023 event-stream + 2024 shai-hulud showed: any of 1000+ transitive deps can be hijacked. Defence: (1) npm audit + Dependabot (basic, free), (2) Socket.dev ($15/mo, runtime behavior analysis), (3) Snyk ($0+), (4) pnpm + strict lockfile, (5) npm package-lock integrity hashing, (6) --ignore-scripts to reject postinstall.
Below: step-by-step, working examples, common pitfalls, FAQ.
npm audit in CI — fails build on > high severitynpm config set ignore-scripts true globally + review per-package"react": "18.2.0" vs "^18.2.0"| Scenario | Config |
|---|---|
| npm audit in CI | # .github/workflows/audit.yml
- run: npm ci
- run: npm audit --audit-level=high
# Fails build on found high+ CVE |
| pnpm strict mode | # .npmrc
strict-peer-dependencies=true
save-exact=true
auto-install-peers=false
# package.json
"packageManager": "pnpm@8.15.0" |
| Socket.dev CI | # Via npm scripts
"scripts": {
"preinstall": "socket preinstall"
}
# Blocks install if supply-chain risk detected |
| Ignore postinstall scripts | # Global
$ npm config set ignore-scripts true
# Per install
$ npm install --ignore-scripts
# For specific trusted packages — whitelist
$ npm rebuild sharp |
| Lockfile integrity (yarn) | # .yarnrc.yml
enableGlobalCache: true
checksumBehavior: update
# Lockfile hashes rejected if corrupted |
The tool checks HTTP security headers, SSL/TLS configuration, server info leaks, and protection against common attacks (XSS, clickjacking, MIME sniffing). A grade fromA to F shows overall security level.
Checking Content-Security-Policy, HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, and more.
TLS version, certificate expiry, chain of trust, HSTS support.
Finding exposed server versions, debug modes, open configs, and directories.
Detailed report explaining each issue with specific steps to fix it.
HTTP header audit
config verification
CSP & HSTS setup
compliance checks
Strict-Transport-Security.Server: Apache/2.4.52 helps attackers find exploits. Hide the version.DENY or SAMEORIGIN.nosniff, browsers may misinterpret file types (MIME sniffing).Content-Security-Policy-Report-Only, monitor violations, then enforce.Server, X-Powered-By, X-AspNet-Version from responses.Security check history and HTTP security header monitoring.
Sign up freeDependabot: GitHub-native, simpler. Renovate: more flexible, works on GitLab/Bitbucket, configurable schedules. Solo projects — Dependabot. Teams with complex policies — Renovate.
Free tier: 5 repos. $15/dev/mo paid. Analyses package behavior (network calls, file ops, eval usage) — detects novel supply-chain attacks.
xz-utils CVE-2024-3094 — backdoor via social engineering after a 2-year maintainer takeover. Would have compromised OpenSSH on major Linux distros. Caught by luck.
pnpm: content-addressable, fast, deterministic. bun: Rust backend, 10x faster. For audit — pnpm/bun show the actual installed graph more precisely than npm.