feat(vulnfeeds): populate package.purl for GIT ranges #3953
+265
−1
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.
This change automatically generates
pkg:generic
pURLs from Git repository URLs found in vulnerability data.A new
BuildGenericRepoPURL()
helper converts URLs from common forges (e.g., GitHub, GitLab, self‑hosted) into thepkg:generic/{host}/{namespace}/{name}
format and enriches records that contain GIT-type ranges; existing pURLs are not overwritten.For example,
https://github.com/user/repo would generate the pURL:
pkg:generic/github.com/user/repo
In addition, when packaging directly from source, versioned repo pURLs derived from tags (e.g.,
pkg:generic/github.com/org/repo@repo-x-y-z
) are exposed underaffected.database_specific.repo_purls
;the standard
affected.package.purl
remains the base (unversioned) identifier as per OSV schema.Unit tests validate the conversion logic and enrichment behavior, and module files are updated accordingly.
Some changes are still needed, especially for frontend display and backfilling historical Git ranges, but I think those can be added in a follow-up pull request.
Fixes #3807