Skip to content

chore: add npm supply-chain hardening#1

Merged
kitze merged 3 commits into
mainfrom
codex/npm-supply-chain-hardening
May 13, 2026
Merged

chore: add npm supply-chain hardening#1
kitze merged 3 commits into
mainfrom
codex/npm-supply-chain-hardening

Conversation

@kitze

@kitze kitze commented May 13, 2026

Copy link
Copy Markdown
Owner

Adds repo-level package manager guardrails after the TanStack npm supply-chain incident:

  • npm: disable install scripts and add a 3-day release-age gate
  • pnpm: block exotic transitive deps, require explicit build-script trust, add release-age/trust-policy guards
  • bun/yarn: add release-age gates when their lockfiles are present
  • Dependabot: add npm cooldown when no config exists yet

These are intentionally behavior-changing install defaults, so this is opened as a PR instead of pushed straight to the default branch.

Summary by CodeRabbit

  • Chores
    • Configured automated dependency update management with weekly schedule and differentiated review timelines for major, minor, and patch version updates
    • Updated package manager configurations to enforce minimum release age thresholds, enhancing stability and security of project dependencies
    • Implemented additional safety measures to prevent automatic script execution during package installation

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR adds configuration for automated dependency management across npm and Bun ecosystems. Dependabot is configured to check for npm updates weekly, while npmrc and bunfig.toml enforce minimum release age thresholds to prevent premature adoption of newly published dependencies.

Changes

Dependency Management Configuration

Layer / File(s) Summary
Automated updates and installation safety policies
.github/dependabot.yml, .npmrc, bunfig.toml
Dependabot checks for npm updates weekly with 7-day semver thresholds. npmrc ignores lifecycle scripts and enforces a 3-day minimum release age. bunfig.toml sets Bun's minimum release age to 3 days (259200 seconds), ensuring dependencies have been public long enough before automatic adoption.

🎯 1 (Trivial) | ⏱️ ~3 minutes

🐰 Dependencies now age like fine carrots,
Seven days for Dependabot to spot,
Three more days for npm and Bun to wait—
Safe adoption happens, never too late!

🚥 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 summarizes the main change: adding npm supply-chain hardening configurations. It directly relates to the core purpose of the PR.
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 codex/npm-supply-chain-hardening

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:
- Line 2: The repo adds min-release-age in .npmrc which requires npm >=11.10.0
but no npm version is pinned; update package.json to declare the required npm
version (use the engines.npm field or the packageManager field with a lockfile
version, e.g., "npm@>=11.10.0") and add a CI enforcement step to fail builds
when the runner npm version is older (validate npm -v or use the same
packageManager tool in CI); reference the package.json fields engines.npm and
packageManager and ensure CI checks the npm version before installing so
min-release-age is actually enforced.
🪄 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: 2e0f6a5d-0b40-43eb-940d-c7fc5eed5c91

📥 Commits

Reviewing files that changed from the base of the PR and between e64f792 and 352c10c.

📒 Files selected for processing (3)
  • .github/dependabot.yml
  • .npmrc
  • bunfig.toml

Comment thread .npmrc
@@ -0,0 +1,2 @@
ignore-scripts=true
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 | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

What npm CLI version introduced .npmrcsupport formin-release-age, and what is npm's behavior when this key is unknown or unsupported?

💡 Result:

npm CLI version 11.10.0 introduced support for the min-release-age key in .npmrc [1][2][3]. This feature was added via pull request #8965, merged in commit 66d6e11 on 2026-02-10, and released on 2026-02-11 [4][3]. Secondary sources confirm it requires npm v11.10.0 or above [5][6].

Citations:


🏁 Script executed:

# Check for package.json and look for npm version constraints
git ls-files | grep -E "(package\.json|\.npmrc|pnpm-lock|\.nvmrc)" | head -20

Repository: kitze/apple-crusher

Length of output: 83


🏁 Script executed:

# Look for CI configuration files
git ls-files | grep -E "(\.(github|gitlab|circleci)|\.travis|\.drone|Jenkinsfile|appveyor|\.github/workflows)" | head -20

Repository: kitze/apple-crusher

Length of output: 86


🌐 Web query:

npm behavior with unknown or unsupported keys in .npmrc configuration file

💡 Result:

When npm reads a.npmrc file, it only recognizes configuration keys that are officially defined for npm. If your.npmrc contains unknown/unsupported top-level keys, npm behavior (as of npm v11) is: 1) npm warns about unknown keys starting in npm v11.2.0 - npm’s.npmrc documentation states that “Starting in npm v11.2.0, npm warns when unknown configuration keys are defined in.npmrc.” [1] - The warning format is illustrated (e.g., “warn Unknown user config "electron_mirror". This will stop working in the next major version of npm.”). [1] 2) Historically tolerated keys will eventually stop working (and may become hard errors) - The docs explicitly say that these unknown keys “were historically tolerated but are not officially supported” and that “A future major version of npm will treat unknown top-level keys as errors.” [1] - npm/cli issue discussions reiterate the intended deprecation and that unknown keys produce warnings with future versions. [2][3] 3) Recommended handling for “third-party” config keys - npm’s docs recommend that “Custom keys intended for third-party tools (for example, electron-builder) should not be placed in.npmrc.” [1] - Instead, it recommends using environment variables for cross-platform configuration. [1] Practical implication - In current npm v11.x, unknown.npmrc keys typically do not get applied as npm config; they mainly cause warnings and are slated for breakage in a future major release. [1] If you tell me the specific.npmrc keys you’re using (the exact lines), I can tell you whether they’re recognized npm config keys or likely fall into the “unknown/unsupported” category per npm’s documented behavior.

Citations:


🌐 Web query:

npm v10 npm v11 npm v12 support for .npmrc keys and handling of unknown configuration keys

💡 Result:

npm v10 supports all standard.npmrc keys as listed in the official config documentation, with no warnings or errors for unknown keys[1][2]. npm v11 (starting from v11.2.0) introduced warnings for unknown/unsupported configuration keys in.npmrc files (user, project, global). Only officially supported keys are recognized; custom keys (e.g., electron_mirror for third-party tools) trigger warnings like "npm warn Unknown user config 'key'. This will stop working in the next major version of npm."[3][4][5][6][7]. Recommendations: Use package.json#config for package-specific settings (exposed as npm_package_config_* env vars, no warnings), environment variables, or CLI flags with --[4][5]. npm v12: No specific changes found in current releases (latest v11.13.0 as of 2026-05-13); warnings continue from v11[8][9][10][11]. A proposed breaking change to make unknown.npmrc keys hard errors (instead of warnings) is open in npm/cli#9276 (created 2026-04-23), targeted for a future major version (likely v12), along with errors for unknown CLI flags/abbreviations[12]. As of now, v12 docs not available, handling matches v11 (warnings). Supported keys are consistent across versions: auth-related (_auth, _authToken, etc., must be registry-scoped), registry, cache, etc. See full list in docs[1][4][2][13]. Custom/third-party keys never officially supported; prior tolerance ended with warnings in v11[4][5]. Use npm config ls to list active configs, npm config edit to edit.npmrc[14].

Citations:


🏁 Script executed:

# Read package.json to check npm version constraints
cat package.json

Repository: kitze/apple-crusher

Length of output: 1212


Require npm ≥11.10.0 for min-release-age guardrail.

The min-release-age key requires npm v11.10.0 or later. Without pinning npm (via engines.npm in package.json or packageManager field), developers on npm v10 will silently ignore this setting, and those on npm v11.0–v11.9 will receive warnings but still skip enforcement. Add an npm version constraint and enforce it in CI to ensure the guardrail is consistently applied.

🤖 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 at line 2, The repo adds min-release-age in .npmrc which requires npm
>=11.10.0 but no npm version is pinned; update package.json to declare the
required npm version (use the engines.npm field or the packageManager field with
a lockfile version, e.g., "npm@>=11.10.0") and add a CI enforcement step to fail
builds when the runner npm version is older (validate npm -v or use the same
packageManager tool in CI); reference the package.json fields engines.npm and
packageManager and ensure CI checks the npm version before installing so
min-release-age is actually enforced.

@kitze kitze merged commit e9ed4ab into main May 13, 2026
2 checks passed
@kitze kitze deleted the codex/npm-supply-chain-hardening branch May 13, 2026 09:49
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.

1 participant