ELSEIF
Your brief EB
326 stories from 101 feeds 302 clusters Refreshed 8 minutes ago next pull 09:36

DEV TOOLS Signal 426

npm 12 disables install scripts by default and blocks non-registry dependencies

npm 12 changes install behavior to require explicit approval for lifecycle scripts and blocks git and remote tarball dependencies by default.

WHY IT MATTERS

Engineers upgrading to npm 12 must review and explicitly allow dependency lifecycle scripts, including implicit node-gyp builds, or installs will fail. The change also closes code execution paths via git and remote tarball dependencies, but requires new workflows for approving trusted packages. Teams should test with npm 11.16.0 warnings to prepare.

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

allowScripts defaults to off, so preinstall, install, and postinstall scripts no longer run without explicit approval.

02

--allow-git and --allow-remote default to none, blocking git and https tarball dependencies.

03

Existing ignore-scripts=true takes precedence and can silently defeat the allowlist, and npm approve-scripts has a chicken-and-egg problem for newly installed packages.

THE READ

What the cluster adds up to.

ORIGINAL ANALYSIS

npm 12 shifts the default for dependency lifecycle scripts from automatic execution to explicit opt-in. The allowScripts setting now defaults to off, meaning preinstall, install, and postinstall scripts will not run unless a developer approves them. This includes implicit node-gyp builds for packages with a binding.gyp file, even when no install script is declared. The change also blocks git and remote tarball dependencies by default, closing code execution paths that could be abused.

Adopting this change costs developers time and attention. Every dependency that relies on lifecycle scripts must be reviewed and added to an allowlist in package.json. Global installs and npx cannot use approve-scripts and require configuration instead, such as setting allow-scripts in user config. There is also a chicken-and-egg problem: npm approve-scripts reads from node_modules, so newly installed packages that need approval will error with ENOMATCH until they are installed.

The new defaults have limitations. An existing ignore-scripts=true setting takes precedence and silently defeats the allowlist, so teams with that configuration may not see the expected protection. Security researchers warn of approval fatigue, as popular packages like esbuild, sharp, core-js, puppeteer, and bcrypt rely on lifecycle scripts. Repeated broken builds could turn deny-by-default into a click-through prompt, pushing attacker activity onto less visible surfaces.

npm is the last major package manager to adopt these controls; pnpm, yarn, and bun already offer similar allowlisting or age gates. Community reaction is broadly supportive, with some developers calling postinstall scripts a long-standing problem. However, legitimate use cases like patch-package are cited as reasons for caution. The change addresses a real threat: JFrog reports that these three vectors were involved in roughly 53% of malicious npm attacks observed in the past year.

Written by elseif from the cluster below · checked for specifics the sources never contained

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
InfoQ npm 12 Released: Install Scripts Off by Default as Registry Moves to Explicit Trust Open ↗