Skip to content
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

Bubble up expected pub security update errors to the user #7880

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions pub/lib/dependabot/pub/update_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ def updated_requirements
# Ideally we would like to do any upgrade that migrates away from the vulnerability
# but this method can only return a single requirement udate.
breaking_changes = updates.filter { |d| d["previousConstraint"] != d["constraintBumpedIfNeeded"] }
if breaking_changes.size > 1
raise "Cannot upgrade from vulnerability without unlocking other packages."
end

# This security update would require unlocking other packages, which is not currently supported.
# Because of that, return original requirements, so that no requirements are actually updated and
# the error bubbles up as security_update_not_possible to the user.
return depedency.requirements if breaking_changes.size > 1
Copy link
Member

Choose a reason for hiding this comment

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

Is depedency a typo? If so, I'm actually kinda surprised Rubocop isn't able to flag this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😮 Nice catch! It sounds like a changed one unexpected error with another 😬. Will fix!

Regarding catching this, I think a spell checker would catch this easily?

Copy link
Contributor Author

Choose a reason for hiding this comment

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


updates.find { |u| u["name"] == dependency.name }
else
Expand Down