← All stories
● Covered by 1 source · 1 reportMedium impact1 neutral

npm 12 Released with Install Scripts Off by Default for Enhanced Security

🔄 Updated 1d ago
New to BrevFeed? We gather this story from every outlet covering it into one summary — ranked by real-world impact, not just the latest headline — so you never miss what matters. What is BrevFeed? →

Key points

  • npm 12 defaults `allowScripts` to off, disabling automatic script execution.
  • Git and remote tarball dependencies are also blocked by default.
  • Developers must explicitly approve scripts or configure allowances.
  • Granular access tokens bypassing 2FA are deprecated.

Default Script Execution Disabled

npm 12, maintained by GitHub, introduces significant security changes by defaulting `allowScripts` to off. This means `preinstall`, `install`, and `postinstall` scripts within dependencies will no longer run automatically. This also applies to implicit `node-gyp` builds for packages containing a `binding.gyp` file and `prepare` scripts from git, file, and link dependencies.

Explicit Opt-In for Script Execution

Developers are now required to review pending scripts, approve trusted ones, and commit the resulting allowlist in their `package.json` file. This shift from automatic execution to explicit opt-in aims to reduce the risk of malicious code execution during package installation. These changes were announced in June and were available behind warnings in npm 11.16.0 to allow preparation time.

Blocking Non-Registry Sources

In addition to script changes, npm 12 also modifies defaults for non-registry sources. The `--allow-git` flag now defaults to `none`, closing a code execution path where a Git dependency's `.npmrc` could override the Git executable. Similarly, `--allow-remote` defaults to `none`, blocking `https` tarball dependencies. The `--allow-file` and `--allow-directory` flags remain unchanged.

Guidance and Considerations

GitHub's migration discussion suggests allowing existing scripts first, then tightening controls. Recipes for common tools like Cypress, Playwright, Puppeteer, Electron, and Husky are provided. Global installs and `npx` require configuration via `npm config set allow-scripts=canvas,sharp --location=user`. It has been noted that `ignore-scripts=true` takes precedence over the allowlist, and new package installations can create issues with `npm approve-scripts` if the package is not yet installed.

Deprecation of Granular Access Tokens

Alongside these security enhancements, npm 12 also deprecates granular access tokens that bypass two-factor authentication. This further strengthens the security posture of the npm ecosystem.

✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →

The daily brief

One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.

One email a day. Unsubscribe in one click, any time.

Today's brief

Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.

~7 min · 6 stories · Aug 15

▶ Play today's brief Listen on Spotify

New every morning, and the back catalogue is archived by date.

Primary sources

npm patch-package

Reporting from

npm 12 has been released, making several security-related changes to `npm install` defaults, including disabling automatic execution of install scripts. These changes require developers to explicitly opt-in to script execution, aiming to mitigate supply chain attacks and improve package security.