fix(vulnfeeds): use canonical URLs for repository comparison in GitVersionsToCommits - #5791
Open
jess-lowe wants to merge 2 commits into
Open
fix(vulnfeeds): use canonical URLs for repository comparison in GitVersionsToCommits#5791jess-lowe wants to merge 2 commits into
jess-lowe wants to merge 2 commits into
Conversation
another-rex
previously approved these changes
Aug 6, 2026
another-rex
reviewed
Aug 6, 2026
| metrics.Outcome = models.Error | ||
| return nil, nil, nil | ||
| } | ||
| claimedRepos[vr.Range.GetRepo()] = true |
Contributor
There was a problem hiding this comment.
Can you add a detailed comment on claimedRepo explaining what it does?
Also, we want to claim the raw range repo (vr.Range.GetRepo()) no matter if we canonicalized it or not right?
|
|
||
| // GitVersionsToCommits examines repos and tries to convert versions to commits by treating them as Git tags. | ||
| // Returns the resolved ranges, unresolved ranges, and successful repos involved. | ||
| func GitVersionsToCommits(versionRanges []models.RangeWithMetadata, repos []string, metrics *models.ConversionMetrics, cache git.RepoTagsCache) ([]models.RangeWithMetadata, []models.RangeWithMetadata, []string) { |
Contributor
There was a problem hiding this comment.
Could add some tests too to verify this behavior change
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.
Should help fix: #4489
Fixes an issue where repository redirects (e.g.,
facebook/react->react/react) caused version ranges to remain unresolved.Previously, GitVersionsToCommits compared raw repository URLs from version ranges against candidate repositories. If a range used a non-canonical URL (e.g., sourced from the CPE dictionary) but the candidate list used the canonicalized URL (or vice versa), the comparison would fail, leaving the range unresolved.
Changes