Keep the comparator from last_known_affected_version_range - #2455
Open
arpitjain099 wants to merge 1 commit into
Open
arpitjain099 wants to merge 1 commit into
arpitjain099 wants to merge 1 commit into
Conversation
Signed-off-by: Arpit Jain <[email protected]>
This branch has not been deployed
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.
get_last_known_affected_versionparses GitHub'slast_known_affected_version_rangeinto a range and then returns onlyaffected_version_range.constraints[0].version, dropping the comparator.get_version_ranges_constraintsputs it back as<=:The value is usually
<=, so most of the time this is a no-op. When GitHub publishes a strict<, the rewrite marks one more version affected than GitHub says.GHSA-x684-96hh-833xis an example: the API gives>= 5.0.0-RC1, < 5.5.5and this producesvers:composer/>=5.0.0-RC1|<=5.5.5, so Craft CMS 5.5.5, a real release that is not affected, is reported as affected.The second entry in that same advisory comes out right, because it has no
last_known_affected_version_rangeand takes the plain<path.Now the helper returns the whole
VersionConstraintand the caller uses it as parsed. I counted the GHSA corpus while looking at this: of 1916 affected entries carrying alast_known_affected_version_range, 1755 are<=and unaffected by this, 161 are a strict<, and 106 of those are in an ecosystemgithub_osv_importer_v2imports.Two cases added to
test_osv_v2.py: the helper keeps<and<=as published, andget_version_ranges_constraintscarries a strict bound through. Both fail on main, 20 pass here, black and isort clean.