npm 12 Install Scripts Disabled by Default (Supply Chain Hardening Update)
First seen Jul 10, 2026 · Updated Jul 10, 2026
GitHub has released npm version 12, which disables automatic execution of package install scripts by default and deprecates granular access tokens (GATs) that could be used to bypass two-factor authentication. This is a defensive supply-chain security improvement aimed at reducing the risk of malicious packages executing arbitrary code during installation, a common vector in npm supply-chain attacks.
Technical Analysis
npm install scripts (preinstall, install, postinstall) have historically been abused by malicious or compromised packages to execute arbitrary code at install time, enabling credential theft, backdoor installation, and lateral movement without any explicit user action beyond running 'npm install'. In npm 12, the allowScripts setting now defaults to off, requiring developers to explicitly opt in before install scripts run, and granular access tokens that previously allowed 2FA-bypassing publish operations are being deprecated to close a known account-takeover gap. This is a mitigation/hardening change rather than an active exploit, but it directly addresses a widely exploited class of npm supply-chain attacks (e.g., typosquatting and dependency confusion campaigns that rely on postinstall payloads). Organizations that delay upgrading or that broadly re-enable allowScripts for convenience remain exposed to the underlying risk this change is designed to mitigate. AI agent frameworks and LLM tool-use pipelines that programmatically install npm dependencies (e.g., coding agents, autonomous DevOps agents, or MCP tool servers pulling packages at runtime) are especially impacted, since such agents may auto-run 'npm install' without human review, making default-disabled install scripts a meaningful control against malicious packages injecting code or exfiltrating API keys/credentials used by the agent.
Affected Systems
npm CLI versions prior to npm 12; Node.js projects and CI/CD pipelines using npm install with install/postinstall scripts; npm accounts using granular access tokens (GATs) for publishing
Indicators of Compromise
- N/A - this is a defensive product update, not an active attack campaign
Remediation Steps
- 1
Upgrade to npm 12
Update npm across development, CI/CD, and agent/automation environments to benefit from install scripts being disabled by default.
- 2
Audit allowScripts usage
Review any project or pipeline configuration that re-enables allowScripts and justify each exception; prefer explicit allowlists of trusted packages.
- 3
Migrate off granular access tokens
Transition npm publishing workflows to fully 2FA-enforced authentication methods before GATs are deprecated/removed.
- 4
Review agent/automation dependency installs
Ensure AI agents, CI bots, and autonomous build systems that run 'npm install' inherit the secure defaults and do not bypass script restrictions, since these systems often run unattended with elevated credentials or API keys.
- 5
Enable dependency scanning
Use SCA tools (e.g., npm audit, Socket.dev, Snyk) to detect malicious or suspicious install scripts in third-party packages prior to installation.
Industries Most Exposed
Respond to this threat
Pro subscribers get a full AI-generated incident-response playbook for this threat — detection, containment, eradication, and recovery steps — plus an unlimited AI Threat Advisor for questions about your environment.