WIP: narrow golang match comparison for pseudo versions #1810
+47
−3
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.
Summary
This PR attempts to narrow the golang_constraint
Satisfied
logic as a follow up to #1797#1797 allows grype to proceed with matches when it encounters a package with a
pseudo version
. This PR limits those pseudo versions to only be compared against constraints that also contain pseudo versions.This eliminates a case of FP where an incomplete
pseudo version
(which doesn't have the correct main module information) is compared against a valid semver constraint.Example of this FP:
In the above case
v0.0.0-20240414223325-7027f264fbb3
is not <0.1.29
. Syft is unable to determine the main module version for ollama. By comparing the incomplete pseudo version to the semver constraint grype produces a FP.This PR makes it so that packages with versions like
v0.0.0-20240414223325-7027f264fbb3
should only be compared to constraints that also have a similar format.