Pass --min-release-age=0 for npm security updates to bypass npmrc#15139
Open
yeikel wants to merge 1 commit into
Open
Pass --min-release-age=0 for npm security updates to bypass npmrc#15139yeikel wants to merge 1 commit into
--min-release-age=0 for npm security updates to bypass npmrc#15139yeikel wants to merge 1 commit into
Conversation
1 task
--min-release-age=0 for npm security updates to bypass npmrc
1 task
c73617c to
6e776fe
Compare
6e776fe to
1fa04bf
Compare
…ting When a project sets min-release-age in .npmrc, npm refuses to install package versions released more recently than the configured age window. Dependabot ignores its own cooldown for security updates, but min-release-age is enforced by npm itself at runtime, so security update PRs fail with ETARGET when the fix version is too new. Pass --min-release-age=0 to the npm install command in NpmLockfileUpdater when running a security update job, overriding the .npmrc setting only for that invocation. The security_updates_only flag is threaded from the Job through DependencyChangeBuilder and FileUpdater options into NpmLockfileUpdater. Fixes dependabot#15112
af699b2 to
7c2f6a2
Compare
Contributor
Author
|
The tests failures are unrelated to my changes but I re-generated them here dependabot/smoke-tests#518 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are you trying to accomplish?
When a project sets
min-release-agein.npmrc, npm refuses to resolve versions newer than the configured age window. This blocks security updates when the fix version was released too recently, producing anETARGETerror. For security updates the age restriction should not apply, so--min-release-age=0is now appended to thenpm installcommand when security advisories are present.Fixes #15112
How will you know you've accomplished your goal?
I documented and tested with a reproducer : https://github.com/yeikel/dependabot-reproducer-issue-15112
Example failure: https://github.com/yeikel/dependabot-reproducer-issue-15112/actions/runs/26425464099
Example logs:
Validating the change involved running my updated version in the security context using the reproducer:
Job details
{ "job": { "command": "security", "allowed-updates": [ { "dependency-type": "direct", "update-type": "all" } ], "commit-message-options": { "prefix": null, "prefix-development": null, "include-scope": null }, "credentials-metadata": [ { "type": "git_source", "host": "github.com" } ], "debug": null, "dependencies": [ "lodash" ], "dependency-groups": [], "dependency-group-to-refresh": null, "existing-pull-requests": [], "existing-group-pull-requests": [], "experiments": { "record-ecosystem-versions": true, "record-update-job-unknown-error": true, "proxy-cached": true, "enable-corepack-for-npm-and-yarn": true, "enable-private-registry-for-corepack": true, "allow-refresh-for-existing-pr-dependencies": true, "allow-refresh-group-with-all-dependencies": true, "azure-registry-backup": true, "enable-enhanced-error-details-for-updater": true, "gradle-lockfile-updater": true, "enable-exclude-paths-subdirectory-manifest-files": true }, "ignore-conditions": [], "lockfile-only": false, "max-updater-run-time": 2700, "package-manager": "npm_and_yarn", "requirements-update-strategy": null, "reject-external-code": false, "security-advisories": [ { "dependency-name": "lodash", "patched-versions": [], "unaffected-versions": [], "affected-versions": [ ">= 4.0.0 <= 4.17.23" ] }, { "dependency-name": "lodash", "patched-versions": [], "unaffected-versions": [], "affected-versions": [ "<= 4.17.23" ] }, { "dependency-name": "lodash", "patched-versions": [], "unaffected-versions": [], "affected-versions": [ ">= 4.0.0 <= 4.17.22" ] }, { "dependency-name": "lodash", "patched-versions": [], "unaffected-versions": [], "affected-versions": [ ">= 4.0.0 < 4.17.21" ] }, { "dependency-name": "lodash", "patched-versions": [], "unaffected-versions": [], "affected-versions": [ "<= 4.17.21" ] }, { "dependency-name": "lodash", "patched-versions": [], "unaffected-versions": [], "affected-versions": [ "< 4.17.21" ] }, { "dependency-name": "lodash", "patched-versions": [], "unaffected-versions": [], "affected-versions": [ ">= 3.7.0 < 4.17.19" ] }, { "dependency-name": "lodash", "patched-versions": [], "unaffected-versions": [], "affected-versions": [ ">= 4.7.0 < 4.17.11" ] }, { "dependency-name": "lodash", "patched-versions": [], "unaffected-versions": [], "affected-versions": [ "< 4.17.12" ] }, { "dependency-name": "lodash", "patched-versions": [], "unaffected-versions": [], "affected-versions": [ "< 4.17.11" ] }, { "dependency-name": "lodash", "patched-versions": [], "unaffected-versions": [], "affected-versions": [ "< 4.17.5" ] } ], "security-updates-only": true, "source": { "provider": "github", "repo": "yeikel/dependabot-reproducer-issue-15112", "branch": null, "api-endpoint": "https://api.github.com/", "hostname": "github.com", "directories": [ "/." ] }, "updating-a-pull-request": false, "update-subdependencies": false, "vendor-dependencies": false, "enable-beta-ecosystems": false, "repo-private": false, "multi-ecosystem-update": false, "exclude-paths": null } }Before
After
Checklist