This repository was archived by the owner on Aug 5, 2026. It is now read-only.
chore: upgrade to NPM v12 - #24
Open
coderbyheart wants to merge 1 commit into
Open
Conversation
Require npm >=12.0.2 <13, enforced via check-node-version on npm install and npm ci. The motivation is that npm v12 turns three code-execution paths off by default, most notably the unauthorized execution of install scripts: - allowScripts now defaults to off, so npm install no longer executes preinstall, install or postinstall scripts from dependencies unless they are explicitly allowed in package.json. This also covers prepare scripts from git, file and link dependencies. - --allow-git now defaults to none, which closes a code-execution path where a git dependency's .npmrc could override the git executable, even with --ignore-scripts. - --allow-remote now defaults to none, blocking dependencies from remote URLs such as HTTPS tarballs. See https://github.blog/changelog/2026-06-09-upcoming-breaking-changes-for-npm-v12/ The Node.js requirement is left unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Require npm
>=12.0.2 <13for this project. The Node.js requirement is left unchanged. It is enforced viacheck-node-versionfrom thepreparescript.Why
npm v12 turns three code-execution paths off by default — most notably the
unauthorized execution of install scripts, which is the primary vector for
supply-chain attacks via compromised dependencies
(GitHub changelog):
allowScriptsnow defaults to off, sonpm installno longer executespreinstall,installorpostinstallscripts from dependencies unless theyare explicitly allowed in
package.json. This also coverspreparescriptsfrom
git,fileandlinkdependencies.--allow-gitnow defaults tonone, which closes a code-execution pathwhere a git dependency's
.npmrccould override the git executable, even with--ignore-scripts.--allow-remotenow defaults tonone, blocking dependencies from remoteURLs such as HTTPS tarballs.
Pinning
engines.npmto>=12.0.2 <13and failing the install when it is notmet means these protections cannot be silently bypassed by running an older npm
locally or in CI.
How
engines.npmis set to>=12.0.2 <13.engines.nodeis left untouched.check-node-version --packageruns from thepreparescript, which npmexecutes on
npm installandnpm ci.actions/setup-nodestep that installs dependencies with npm.
Note on the
package-lock.jsondiffnpm 12 rewrites this lock file from
lockfileVersion1 to3, so the diff is large. This is a format migration, not a dependency
update: 933 already-locked packages keep byte-identical versions, the only
additions are
check-node-versionand its transitive dependencies.The rewrite is unavoidable — the first
npm installon npm 12 produces it eitherway — so it is included here rather than left to land unreviewed later.