GitHub readies npm v12 approvals to stop install attacks

GitHub says npm v12, due next month, will block several high-risk behaviors during npm install unless developers explicitly approve them—shifting trust away from automatic script execution and non-registry dependency sources used in recent supply-chain attacks
On an ordinary morning—clone a repo, pull updates, run a CI build—developers expect npm to “just work.” But for attackers chasing supply-chain access, that predictability has been an open door.
GitHub says npm v12. expected next month. will introduce security-focused defaults designed to choke off attack paths that are triggered by the npm install command. That command is what downloads and installs a project’s dependencies and also runs install-related scripts defined by packages. It’s executed after cloning a project. pulling updates. or during CI/CD builds—exactly the kind of automation adversaries like.
The change is blunt in purpose: code execution and non-registry dependency sources that currently activate automatically during npm install will now require explicit approval instead of being trusted by default.
Starting in version 12. npm install will not run preinstall. install. or postinstall scripts from dependencies unless they have been explicitly approved. GitHub says this also applies to native module builds triggered through node-gyp. and prepare scripts from Git. local file. and linked dependencies.
The platform is also tightening where dependencies come from. In version 12, npm install will no longer fetch dependencies from Git repositories—whether direct or transitive—unless explicitly permitted. GitHub says this removes a code execution path where a Git dependency’s .npmrc file could alter which Git executable is used. even when install scripts are disabled.
Remote URLs won’t be automatic either. Dependencies installed from remote URLs, such as HTTPS tarballs, will no longer be resolved unless explicitly permitted, and this applies to both direct and transitive dependencies.
GitHub’s message is that these defaults can significantly reduce supply-chain attacks by removing the automatic execution of dependency installation scripts, the automatic resolution of Git-based dependencies, and the automatic resolution of remote URL dependencies.
The timing matters because GitHub says the new defaults could disrupt several attack techniques used in recent supply-chain incidents. That includes malicious preinstall/postinstall script campaigns targeting eslint-config-prettier. Toptal’s Picasso packages. dozens of data-stealing npm packages. and Git dependency abuse documented in Shai-Hulud attacks.
But the company is also warning that legitimate projects may have depended on the very behaviors now being controlled. Teams that rely on these behaviors for legitimate workflows will need to explicitly opt in before upgrading to npm v12.
For preparation, GitHub recommends upgrading to npm 11.16.0 or newer. In that version line, npm displays warnings on all actions that will break under version 12. The idea is simple: developers can run their normal install routines. see what would fail. and identify which dependencies or workflows will require explicit approval before they move to npm v12.
After the upgrade to version 12, GitHub says only explicitly approved scripts and dependency sources will continue functioning automatically.
A community discussion has been opened for developers to share their suggestions on the upcoming changes—because for many teams, the hard part won’t be understanding the risk. It will be updating build pipelines and dependency practices without breaking the software they depend on every day.
GitHub npm npm v12 supply-chain attacks supply chain security npm install scripts preinstall postinstall node-gyp .npmrc Git dependencies HTTPS tarballs cybersecurity developer security