VYPR
patchPublished Jun 10, 2026· Updated Jun 13, 2026· 5 sources

GitHub Overhauls npm Install to Thwart Supply-Chain Attacks

GitHub is introducing significant security enhancements to npm v12, set to block automatic script execution and dependency fetching during 'npm install' to combat supply-chain threats.

GitHub has announced a major security overhaul for its npm package manager, with version 12 slated for release next month. The update introduces a series of changes designed to significantly bolster defenses against the growing threat of supply-chain attacks that exploit the 'npm install' process.

The 'npm install' command, a fundamental step for developers to download and set up project dependencies, has become a prime target for attackers. This is due to its capability to automatically execute scripts defined within packages, providing a potent vector for malicious code injection during the installation phase.

Under the new default settings in npm v12, automatic execution of preinstall, install, and postinstall scripts will be disabled. This also extends to native module builds via node-gyp and prepare scripts for Git, local file, and linked dependencies. Developers will now need to explicitly approve these actions, shifting from a trust-by-default model to a more secure explicit-approval mechanism.

Furthermore, npm v12 will cease fetching dependencies directly from Git repositories unless explicitly permitted. This change aims to close a significant attack path where malicious .npmrc files could manipulate the Git executable used during installation, even when install scripts were disabled. Similarly, dependencies fetched from remote URLs, such as HTTPS tarballs, will also require explicit permission, preventing their automatic resolution.

These stringent new defaults are poised to disrupt numerous attack techniques that have been prevalent in recent supply-chain compromises. This includes malicious script campaigns targeting popular packages like eslint-config-prettier, Toptal's Picasso packages, and various data-stealing npm packages. The changes also address abuse of Git dependencies seen in campaigns like Shai-Hulud.

Projects that legitimately rely on the automatic execution of these scripts or Git/remote URL dependencies will need to take action to explicitly opt in to these behaviors before upgrading to npm v12. GitHub recommends that developers prepare for this transition by upgrading to npm 11.16.0 or newer. This version displays warnings for actions that will be blocked in v12, allowing developers to identify and address potential workflow disruptions during their normal installation routines.

By requiring explicit approval for script execution and dependency sources, GitHub aims to create a more resilient software supply chain. This proactive approach forces developers to be more aware of the dependencies they are incorporating and the potential risks associated with them, thereby reducing the attack surface for malicious actors.

GitHub detailed the specific breaking changes in npm version 12, including the blocking of Git dependencies and remote tarball URLs by default, and recommended developers upgrade to npm 11.16.0 to preview warnings. The company also highlighted that the new 'allowScripts' behavior blocks native node-gyp builds, closing a code execution path even when '--ignore-scripts' is used.

Further details published on June 11 confirm that the allowScripts configuration will default to off in npm v12 (July 2026), blocking preinstall, install, and postinstall scripts without explicit opt-in. The update also restricts Git-based and remote-URL dependencies via new --allow-git and --allow-remote flags, both defaulting to none. Developers can preview blocked scripts using npm approve-scripts --allow-scripts-pending and manage trust via npm approve-scripts/npm deny-scripts, with the allowed list stored in package.json.

The article adds expert reactions from Isaac Evans (Semgrep) and Paul McCarty (6mile), who caution that while the defaults are a meaningful step, attackers may pivot to private repositories and developers may blindly approve blocked scripts, potentially creating new security blind spots. McCarty also warns that benign maintainers may adopt suspicious workarounds, complicating malware detection.

GitHub detailed new mitigations beyond the script-blocking default: starting with npm 12 (due July 2026), Git dependencies and remote HTTPS tarballs will no longer be resolved during npm install unless explicitly allowed, closing a code-execution path that .npmrc overrides could exploit. The advisory also links directly to the Shai-Hulud Miasma attacks, which weaponized binding.gyp files, as a motivating incident. Developers can test the upcoming restrictions now by running npm approve-scripts --allow-scripts-pending on npm 11.16.0+.

Synthesized by Vypr AI