Skip to content
This repository was archived by the owner on Aug 26, 2026. It is now read-only.

chore(npm): enforce seven-day release age - #37

Merged
yugui923 merged 1 commit into
mainfrom
hermes/npm-release-age-policy
Jul 13, 2026
Merged

yugui923 merged 1 commit into
mainfrom
hermes/npm-release-age-policy

Conversation

@yugui923

@yugui923 yugui923 commented Jul 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add a project-level npm release-age policy
  • prevent dependency resolution from selecting versions published less than seven days ago

Validation

  • sfw npm ci
  • npm run typecheck
  • npm run lint
  • npm run format:check
  • npm run build
  • npm run test:coverage
  • npm audit --audit-level=high — 0 vulnerabilities
  • npm 11.18.0 inside the Dev Container reports min-release-age=7
  • staged and branch-scoped Gitleaks scans passed

Generated with Agent Navigator

Summary by CodeRabbit

  • Chores
    • Added a package installation safeguard that prevents installing newly published packages for seven days.

Apply npm's project-level minimum release age so dependency resolution
avoids newly published package versions during their highest-risk window.

Co-Authored-By: Yuri Gui <yugui923@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The .npmrc configuration now requires npm to reject packages published less than seven days earlier and documents the behavior and npm version requirement.

Changes

npm install policy

Layer / File(s) Summary
Release-age installation guard
.npmrc
Adds min-release-age=7 and comments describing the seven-day package-age restriction and npm version constraints.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: enforcing a seven-day npm release-age policy.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hermes/npm-release-age-policy

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.

@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 1-5: Update the comment above the npm min-release-age
configuration to explicitly state that releases published seven days ago or less
are blocked, clarifying that the seven-day boundary is inclusive; leave the
min-release-age value unchanged.
🪄 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: 0f0e1205-b0ec-4081-8ff9-0a00bbe729ec

📥 Commits

Reviewing files that changed from the base of the PR and between e1ae2a9 and 6fe6f22.

📒 Files selected for processing (1)
  • .npmrc

Comment thread .npmrc
Comment on lines +1 to +5
# Refuse to install npm packages published less than 7 days ago.
# Defense against compromised-maintainer publishes (typically yanked
# within hours). Requires npm >= 11.10.0; value is in DAYS (unlike
# pnpm/Yarn which use minutes, or Bun which uses seconds).
min-release-age=7

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

npm min-release-age documentation exact boundary seven days ago more than 7 days

💡 Result:

The npm configuration setting min-release-age is an integer value representing a duration in days [1][2][3]. When set, it instructs npm to exclude any package version that was published within the specified number of days from the current time [2][3][4]. For example, setting min-release-age=7 enforces a "cooldown" period of seven days, meaning npm will only consider versions of a package that were published more than seven days ago [2][3]. Key points regarding the boundary and functionality include: - Inclusive Definition: The setting acts as a relative date filter [1]. If you set min-release-age=7, a version published exactly 7 days ago (or less) is excluded [3][4]. Only versions published more than 7 days ago are eligible for installation [2][3]. - Implementation: It is a configuration option available in npm CLI version 11.10.0 and later [5][2][3]. It works by flattening the relative age value into a specific date (equivalent to the --before configuration) during the resolution process [1][6]. - Exclusivity: The min-release-age setting is mutually exclusive with the --before configuration, as they perform overlapping functions [1][6]. - Scope: The setting applies to package resolution during commands like npm install [1][7]. It does not affect npm ci, as that command installs from the existing package-lock.json file verbatim without performing new resolution [7].

Citations:


Clarify the seven-day boundary. min-release-age=7 blocks versions published 7 days ago or less, so the comment should say that exactly 7-day-old releases are also excluded.

🤖 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 1 - 5, Update the comment above the npm min-release-age
configuration to explicitly state that releases published seven days ago or less
are blocked, clarifying that the seven-day boundary is inclusive; leave the
min-release-age value unchanged.

@yugui923
yugui923 merged commit a6ec235 into main Jul 13, 2026
7 checks passed
@yugui923
yugui923 deleted the hermes/npm-release-age-policy branch July 13, 2026 18:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant