build(npm): allowlist + enforce dependency install scripts - #45569
Open
caugner wants to merge 3 commits into
Open
build(npm): allowlist + enforce dependency install scripts#45569caugner wants to merge 3 commits into
caugner wants to merge 3 commits into
Conversation
npm 12 no longer runs `preinstall`/`install`/`postinstall` from dependencies unless the root `package.json` lists them in `allowScripts`. `npm ci` still succeeds, so a missing entry only surfaces later as a missing binary. Generated with `npm approve-scripts --all --no-allow-scripts-pin`, so the entries are name-only and keep matching after a dependency bump.
8 tasks
Turns an uncovered dependency install script into a hard `npm ci` error instead of a silently skipped script. npm 11.16+ already honors this option, so it takes effect on the current toolchain, not only on npm 12.
Node.js 24.20.0 bundles npm 11.19.0, the first bundled npm version that understands `allowScripts` and `strict-allow-scripts`, so CI and local installs run with an npm that enforces the install-script allowlist.
caugner
marked this pull request as ready for review
September 8, 2026 16:33
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Add an
allowScriptsallowlist for the dependencies with install scripts, enablestrict-allow-scripts, and bump the Node.js and npm pins.Motivation
npm 12 no longer runs dependency
preinstall/install/postinstallscripts unless the rootpackage.jsonallowlists them, andnpm cistill exits 0, so the failure only shows up later as a missing binary. Without the allowlist,@mdn/rari,gifsicle,mozjpegandpngquant-binnever fetch their binaries andlefthooknever registers its git hooks.Additional details
--no-allow-scripts-pin), so Dependabot bumps do not need re-approval commits, at the cost of trusting future versions of the listed packages.strict-allow-scripts=truein.npmrcturns an uncovered install script into a hardnpm cierror (honored by npm 11.16+, not only npm 12)..nvmrcbumped to v24.20.0 andpackageManagerto npm 11.19.0; the previous pins (Node 24.14.0, npm 11.9.0) predateallowScriptssupport.npx @mdn/rariandnpx @mdn/fredinpr-test.ymlresolve from this repo'snode_modules, so the allowlist covers them.npm ci --strict-allow-scriptspasses on npm 12.0.2 and 11.19.0;npm approve-scripts --allow-scripts-pendingreports nothing.Related issues and pull requests
Part of mdn/fred#1868.
Fixes mdn/fred#1867.