Skip to content

build(config): block npm package versions newer than 3 days - #4483

Merged
ChristianHuehn merged 1 commit into
mainfrom
tech/npm-min-release-age
Jun 10, 2026
Merged

build(config): block npm package versions newer than 3 days#4483
ChristianHuehn merged 1 commit into
mainfrom
tech/npm-min-release-age

Conversation

@ChristianHuehn

@ChristianHuehn ChristianHuehn commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Add min-release-age=3 to root and visualization .npmrc to mitigate fast-burn supply-chain attacks. Enforced by npm >= 11.10, silently ignored by older versions; npm ci and locked versions are unaffected.

{Meaningful title}

Please read the CONTRIBUTING.md before opening a PR.

Closes: #

Description

Descriptive pull request text, answering:

  • What problem/issue are you fixing?
  • What does this PR implement and how?

Definition of Done

A PR is only ready for merge once all the following acceptance criteria are fulfilled:

  • Changes have been manually tested
  • All TODOs related to this PR have been closed
  • There are automated tests for newly written code and bug fixes
  • All bugs discovered while working on this PR have been submitted as issues (if not already an open issue)
  • Documentation (GH-pages, analysis/visualization READMEs, parser READMEs, --help, etc.) has been updated (almost always necessary except for bug fixes)
  • CHANGELOG.md has been updated

Screenshots or gifs

Summary by CodeRabbit

  • Chores
    • Enhanced package dependency stability by enforcing a minimum maturation period for newly published versions, reducing exposure to potential issues in recently released packages.

Add min-release-age=3 to root and visualization .npmrc to mitigate
fast-burn supply-chain attacks. Enforced by npm >= 11.10, silently
ignored by older versions; npm ci and locked versions are unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates npm configuration in both the root and visualization directories to enforce supply-chain security. Both .npmrc files now include min-release-age=3, preventing npm from resolving newly published packages until they have been available for at least three days.

Changes

npm Supply Chain Security Configuration

Layer / File(s) Summary
Minimum release age enforcement
.npmrc, visualization/.npmrc
Both .npmrc files add min-release-age=3 to enforce a three-day minimum age for newly resolved package versions, complementing existing engine-strict=true and ignore-scripts=true settings. The configuration blocks fresh package resolution but does not affect npm ci or already-locked versions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Supply chains are safe, when we take our time,
Three days of waiting, a measured climb.
No rushing scripts, no engines unmet,
CodeCharta's npm, more secure yet!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is largely incomplete. While it provides a clear summary of the change and its purpose, it lacks substantial completion of required template sections like problem/issue explanation and testing details. Complete the Description section with specific details about the supply-chain attack risks being mitigated, and fill out the Definition of Done checklist items with actual status updates.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding min-release-age=3 to npm configuration files to enforce a 3-day minimum package age.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tech/npm-min-release-age

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.npmrc:
- Around line 10-15: The documentation comment for the min-release-age setting
is inaccurate: update the description around the min-release-age key
(min-release-age=3) to state it was introduced in npm CLI v11.10.0, that it
enforces an absolute cutoff of versions published more than N days ago
(calculated as now - N days) and that it applies to dependency resolution during
commands like npm install but does not affect npm ci (which uses the lockfile);
also remove the unsupported claim "silently ignored by older npm" or replace it
with a cited reference if you add one.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 64863658-cf3b-43a9-b69d-6bb56d7a816a

📥 Commits

Reviewing files that changed from the base of the PR and between bba859d and 3937948.

📒 Files selected for processing (2)
  • .npmrc
  • visualization/.npmrc

Comment thread .npmrc
Comment on lines +10 to +15
# Refuse to resolve package versions published less than 3 days ago (value in days,
# enforced by npm >= 11.10, silently ignored by older npm). Fast-burn supply-chain
# compromises are typically detected and unpublished within this window. Only affects
# resolving new versions — `npm ci` and already-locked versions are unaffected. For a
# deliberate fresh install, override with `npm install <pkg> --min-release-age=0`.
min-release-age=3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

What version of npm introduced the min-release-age configuration option and how does it work?

💡 Result:

The min-release-age configuration option was introduced in npm CLI version 11.10.0 [1][2]. How it works: The min-release-age configuration allows you to set a cooldown period for dependency installations to help mitigate supply chain risks [3][1]. When this option is set (as a number of days), npm will only install package versions that were published to the registry more than that number of days ago [4][5][6]. Key operational details: 1. Mechanism: Internally, npm converts the relative min-release-age (in days) into an absolute date (using the current time minus the specified number of days) and applies it similarly to the existing --before configuration [4][7][6]. 2. Precedence: While min-release-age and --before are related, they can coexist in different configuration sources. If both are defined within the same source, the explicit absolute date provided by --before takes precedence [7][5][6]. 3. Usage: You can set it in your.npmrc file or via command-line flags (e.g., npm install --min-release-age=7) [1][2]. 4. Limitations: This configuration is primarily effective for commands that perform dependency resolution, such as npm install [8][5]. It does not affect npm ci, as that command installs packages verbatim from the lockfile without performing new resolution [8]. If no versions satisfy the age requirement for a dependency, the command will error [4][5][6].

Citations:


Update the .npmrc min-release-age documentation to match npm CLI behavior.

  • min-release-age was introduced in npm CLI v11.10.0 and enforces a cutoff so npm only considers versions published more than N days ago (effectively applying an absolute date derived from “now - N days”).
  • The option applies to dependency resolution performed by commands like npm install and does not affect npm ci, since npm ci installs directly from the lockfile without re-resolving.
  • The “silently ignored by older npm” claim isn’t documented in the official CLI references cited here—remove it or add a supporting citation.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.npmrc around lines 10 - 15, The documentation comment for the
min-release-age setting is inaccurate: update the description around the
min-release-age key (min-release-age=3) to state it was introduced in npm CLI
v11.10.0, that it enforces an absolute cutoff of versions published more than N
days ago (calculated as now - N days) and that it applies to dependency
resolution during commands like npm install but does not affect npm ci (which
uses the lockfile); also remove the unsupported claim "silently ignored by older
npm" or replace it with a cited reference if you add one.

@sonarqubecloud

Copy link
Copy Markdown

@ChristianHuehn
ChristianHuehn merged commit 4e095da into main Jun 10, 2026
8 checks passed
@ChristianHuehn
ChristianHuehn deleted the tech/npm-min-release-age branch June 10, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants