Handle uppercase V prefix in semantic version comparison#3429
Closed
tjhub1983 wants to merge 1 commit intoanchore:mainfrom
Closed
Handle uppercase V prefix in semantic version comparison#3429tjhub1983 wants to merge 1 commit intoanchore:mainfrom
tjhub1983 wants to merge 1 commit intoanchore:mainfrom
Conversation
Treat both 'v1.5.0' and 'V1.5.0' equivalently for version matching. Fixes issue anchore#3037 where SBOM files with uppercase V prefix (e.g., 'V1500-SP2') were not matched against CVE vulnerabilities. Changes: - Update regex from ^v\d+ to ^[vV]\d+ to match both cases - Use direct slice [1:] instead of strings.TrimPrefix for consistency Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Thanks for the contribution! Looks like #3089 already covers this one. No worries at all — in the future, if you spot an existing PR for the same thing, adding a comment or 👍 there is a great way to help us prioritize it. Thanks again! |
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.
Summary
Treat both
v1.5.0andV1.5.0equivalently for version matching.Fixes #3037
SBOM files with uppercase V prefix (e.g.,
V1500-SP2) were not being matched against CVE vulnerabilities because the version comparison logic only recognized lowercasevprefix.Changes
^v\d+to^[vV]\d+insemantic_version.go[1:]instead ofstrings.TrimPrefixfor consistencyTesting
Added test cases:
uppercase V prefix comparison:1.5.0vsV1.5.0uppercase V prefix on this version:V1.5.0vs1.5.0🤖 Generated with Claude Code