-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[npm] fix failure to attempt parent update if unfixed transitive update is available #5799
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
bin/dry-run.rb
Outdated
updated_deps.none? { |d| security_fix?(d) } | ||
puts " (updated version is still vulnerable 🚨)" | ||
log_conflicting_dependencies(checker.conflicting_dependencies) | ||
next |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think L743-746 could use one more space of indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! fixed with rubocop in 73b3e51
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@dependabot-fixtures/npm-parent-dependency-with-more-versions": "^1.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
The updater will abort before proceeding with the file update if the proposed update does not fix the vulnerability. It also triggers the conflicting dependencies check. See https://github.com/dependabot/dependabot-core/blob/8ab4d78efe7cf9a75bef76dd883d7ee3fffffb40/updater/lib/dependabot/updater.rb#L274-L282
A newer but still vulnerable version was allowed to return here which would cause the job to eventually fail because it proposed updating to a still vulnerable version. By filtering vulnerable versions here we trigger the updater to consider updating the parent to allow the transtive dep to be updated to a fixed version.
73b3e51
to
65adb4a
Compare
This fixes an issue that prevents Dependabot from trying to update a parent dependency when updating a vulnerable transitive dependency.
Ex: A vulnerability is reported in dependency B for all versions
< 2.0.0
We start with:
To successfully fix this vulnerability we need to update A:
However, if Dependabot found there was a version B was allowed to update to it would propose that instead:
The end result would be the job fails as not possible because it fails the vuln fix check at
dependabot-core/updater/lib/dependabot/updater.rb
Lines 274 to 282 in 8ab4d78
This fix adds detection that the update of B to
1.0.1
is still vulnerable and rejects it so we'll keep looking and find the solution that updates A. I've also tweaked the dry-run script to more closely match the updater.