# Disable preinstall/-weight: 500;">install/postinstall scripts globally for this project
ignore-scripts=true
# Disable preinstall/-weight: 500;">install/postinstall scripts globally for this project
ignore-scripts=true
# Disable preinstall/-weight: 500;">install/postinstall scripts globally for this project
ignore-scripts=true
-weight: 500;">npm -weight: 500;">install --ignore-scripts
-weight: 500;">npm -weight: 500;">install --ignore-scripts
-weight: 500;">npm -weight: 500;">install --ignore-scripts
-weight: 500;">npm -weight: 500;">install --ignore-scripts
# Rebuild only the native deps you trust
-weight: 500;">npm rebuild sharp better-sqlite3
-weight: 500;">npm -weight: 500;">install --ignore-scripts
# Rebuild only the native deps you trust
-weight: 500;">npm rebuild sharp better-sqlite3
-weight: 500;">npm -weight: 500;">install --ignore-scripts
# Rebuild only the native deps you trust
-weight: 500;">npm rebuild sharp better-sqlite3
# In your Dockerfile, GitHub Actions, etc.
-weight: 500;">npm ci --ignore-scripts
# In your Dockerfile, GitHub Actions, etc.
-weight: 500;">npm ci --ignore-scripts
# In your Dockerfile, GitHub Actions, etc.
-weight: 500;">npm ci --ignore-scripts
-weight: 500;">npm view <package-name> --json
# Look for the "attestations" field in the dist block
-weight: 500;">npm view <package-name> --json
# Look for the "attestations" field in the dist block
-weight: 500;">npm view <package-name> --json
# Look for the "attestations" field in the dist block
-weight: 500;">npm publish --provenance --access public
-weight: 500;">npm publish --provenance --access public
-weight: 500;">npm publish --provenance --access public - Run arbitrary code at -weight: 500;">install time via preinstall, -weight: 500;">install, and postinstall scripts
- Get hijacked if the maintainer's account is phished or their token leaks
- Be replaced with a malicious version when ownership transfers to a new maintainer
- Be typosquatted (lodahs vs lodash) and copy-pasted into a Dockerfile at 2am - New top-level packages you don't recognize
- Packages with very recent first-publish dates
- Packages with one maintainer and millions of downloads (single-point-of-failure targets)
- Suspicious names (typos, hyphenation tricks like cross-env-shell vs cross-env) - Pin exact versions in critical projects. Drop the ^ and ~ in package.json. You give up automatic patch updates — you also -weight: 500;">stop new patch releases from running in prod five minutes after publish.
- Use a private registry or proxy. Verdaccio is the open-source standard. It lets you cache, mirror, and gate which versions reach your team.
- Run installs in a sandboxed environment. A locked-down container with no network egress except to the registry is a good starting point. If a postinstall script tries to phone home, the connection fails.
- Generate an SBOM. CycloneDX has a free -weight: 500;">npm plugin. It won't -weight: 500;">stop an attack, but it makes the post-incident question "are we exposed to package X at version Y?" answerable in seconds instead of hours.