chore: require npm versions to be 7 days old before resolution - #706
chore: require npm versions to be 7 days old before resolution#706kparkinson-ld wants to merge 2 commits into
Conversation
Adds npmMinimalAgeGate: 3d so yarn will not resolve a package version published less than 3 days ago, closing the window exploited by npm account-takeover supply-chain attacks (SEC-8921).
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
@cursor review |
|
Should we extend this to 7d, to match our dependabot cooldown policy? |
Yes — agreed, and the data backs it: of the 16 repos in the org that configure a dependabot cooldown, 15 use Raised to Worth reconciling gonfalon's 3d renovate hold separately so the org lands on one number; tracking under SEC-8921. |
Summary
Follow-up to #705, from the SEC-8921 investigation of the npm account-takeover campaign that hijacked
keyv,cache-manager,cacheable-requestand ~39 other packages (Wizwiz-adv-2026-138). #705 stopped hijacked packages from executing install scripts; this stops us from resolving a version that was published minutes ago, which is the window these campaigns live in — malicious versions are typically yanked within hours.npmMinimalAgeGateis native to yarn (added in 4.10.0); this repo is already on 4.13.0, so no yarn bump is needed here. 7 days per @pkaeding's review — it matches thedefault-days: 7dependabot cooldown used in 15 of the 16 org repos that configure one, and comfortably covers npm's 72-hour unpublish window, so we also stop depending on versions that can still vanish. (gonfalon's renovate hold is 3 days and is the outlier; worth reconciling separately.)What it does and doesn't do:
yarn.lockentries install normally, including versions younger than the gate. Nothing already pinned breaks.yarn addon a laptop as well as CI — unlike a renovate/dependabot cooldown, which only gates bot PRs.YN0016: ... All versions satisfying "x.y.z" are quarantined.npmPreapprovedPackagesis the documented escape hatch; nothing needs it today.highlight.run/@launchdarkly/*viaworkspace:*, not from the registry, so our own just-published releases are never gated. No workflow here installs a freshly published version from npm.Cost: picking up a genuine upstream fix (including a Dependabot security bump) can be delayed up to 7 days. Preapprove the package or lower the value if that ever bites.
How did you test this change?
yarn config get npmMinimalAgeGate→10080(minutes).yarn install --immutable— clean, no lockfile churn, no quarantine errors.yarn dedupe --checkandyarn format-check— both pass (the CI steps most likely to be perturbed by a resolver change).yarn add @aws-sdk/client-s3resolved an older version and refused a recently published one, confirming the gate is actually enforced rather than silently ignored.Are there any deployment considerations?
No. Config-only; no runtime or published-artifact change.
Link to Devin session: https://app.devin.ai/sessions/6bf8e18507f94eed85e5c0a806f691ed
Requested by: @kparkinson-ld
Note
Overview
Adds
npmMinimalAgeGate: 7dto.yarnrc.ymlso Yarn only resolves npm package versions published at least seven days ago, complementing the existingenableScripts: falsesupply-chain controls.Existing
yarn.lockpins are unchanged; the gate applies when adding or bumping dependencies (localyarn addand CI alike). Versions that are too new fail with a quarantine error unless exempted vianpmPreapprovedPackages. Workspaceworkspace:*packages are not affected.Reviewed by Cursor Bugbot for commit 6ee65a3. Bugbot is set up for automated code reviews on this repo. Configure here.