Skip to content

Add npm min-release-age=7d cooldown to .npmrc#433

Merged
oxyc merged 1 commit into
masterfrom
feat/npm-min-release-age-7d
May 13, 2026
Merged

Add npm min-release-age=7d cooldown to .npmrc#433
oxyc merged 1 commit into
masterfrom
feat/npm-min-release-age-7d

Conversation

@oxyc
Copy link
Copy Markdown
Member

@oxyc oxyc commented May 13, 2026

Summary

Adds min-release-age=7d to .npmrc — npm refuses to install package versions younger than 7 days.

Why

Defense against rapid-publish supply-chain attacks:

  • Typosquatted package names
  • Versions published from compromised maintainer accounts
  • Malicious post-install scripts pushed under a legitimate maintainer account

By the time a malicious package has been live for a week, it has typically been flagged and yanked. This shifts the install-time risk window from "minutes after publish" to "after a week of public scrutiny."

How it works

  • Requires npm >= 11.10 (released Feb 2026). Older npm silently ignores the key, so committing this is safe regardless of which Node/npm any single dev/CI is on — progressive enhancement.
  • Applies to npm install, lockfile updates, and CI installs alike.
  • Does not affect already-installed packages — only blocks new installs of fresh versions.

Test plan

  • npm install runs normally with no behavior change for established packages.
  • If an urgent pin is needed for a brand-new release, temporarily comment out the line; npm has no per-package exclusion mechanism yet.

Delays installation of newly-published packages by 7 days as a defense against rapid-publish supply-chain attacks. Requires npm >=11.10 to take effect; older npm silently ignores the key, so safe to commit as progressive enhancement.
@oxyc oxyc added the dependencies Pull requests that update a dependency file label May 13, 2026
@oxyc oxyc merged commit 270fec4 into master May 13, 2026
1 check failed
@oxyc oxyc deleted the feat/npm-min-release-age-7d branch May 13, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant