build(npm): allowlist + enforce dependency install scripts - #1869
Merged
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.
Contributor
|
c4e1734 was deployed to: https://fred-pr1869.review.mdn.allizom.net/ |
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 24.20.0 bundles npm 11.19.0, the first bundled version that understands `allowScripts` and `strict-allow-scripts`, so CI runs with an npm that actually enforces the install-script allowlist.
caugner
marked this pull request as ready for review
September 8, 2026 16:33
The published fsevents 2.3.3 tarball ships a prebuilt `fsevents.node` and has no `install` script; only the registry manifest lists one, so approving it grants nothing useful.
LeoMcA
approved these changes
Sep 10, 2026
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, packages such as@mdn/rarinever 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.15.0, npm 11.12.1) predateallowScriptssupport.fseventsis denied (false): its tarball ships a prebuilt binary and has noinstallscript, only the registry manifest lists one.unrs-resolverstays allowed: itspostinstallis a fallback that only does work when the platform-specific optional binding failed to install.mdn/content,mdn/mcpandmdn/dexadd their own@mdn/rarientries in sibling PRs.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 #1868.