Repository navigation
build: Enforce npm install requirements and restrict dependency sources - #8
Merged
Merged
Conversation
maks-rafalko
approved these changes
Nov 5, 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.
The following settings are quite standard to provide a bit of a better security when working on node projects. Nonetheless, they may not be known by everyone so the following description is a Codex explanation for more details of the why for each settings.
Description
The website builds in CI with Node 24, but local installs currently accept other Node and npm versions and can resolve conflicting peer dependencies with a warning. Contributors can therefore commit a dependency tree that behaves differently in CI. The project now requires Node 24 and npm
^11.10.0 || ^12.0, rejects peer dependency conflicts, and provides an.nvmrcso contributors can select the matching Node version withnvm use.Dependency updates also expose contributors and the build environment to code from newly published packages. Even established packages have been compromised: an unauthorised
eslint-scope3.7.2 release stole npm authentication tokens, and three compromisedua-parser-jsreleases contained malware. The 21-day minimum release age gives maintainers and security researchers time to detect and remove malicious releases before dependency updates select them. This reduces exposure to newly published malware, but doesn't establish that an older release is safe. Urgent fixes may need an explicit exception to the delay.Git dependencies allow packages to be installed directly from repositories, outside published registry releases. For example, a dependency can point to a GitHub branch. Before packaging it, npm can install the repository's dependencies and dev dependencies and run its
preparescript (npm install documentation). A maliciouspreparescript could read credentials from the build environment.allow-git=noneblocks direct and transitive Git dependencies, removing this installation path from the website.Contributors can run
nvm use && npm cito install with the declared Node version. The project previously had no engine requirement to reject an install under Node 22. It now fails withEBADENGINEbecause Node 22 doesn't meet the declared requirement.Changes
engine-strict=trueenforces the Node^24.0.0and npm^11.10.0 || ^12.0requirements. npm 11.10.0 is the earliest release supporting all four settings: npm's changelog records the addition ofallow-gitin 11.9.0 andmin-release-agein 11.10.0. npm is declared as the package manager, and the lockfile records the same engine ranges.strict-peer-deps=trueturns peer dependency conflicts into installation failures instead of allowing npm to guess a resolution.min-release-age=21delays selection of new dependency releases, whileallow-git=noneprevents dependencies from being fetched and installed from Git references (npm configuration reference).