feat(cg/transformers): add chainguard osv transformer#3474
Open
crosleyzack wants to merge 7 commits into
Open
Conversation
crosleyzack
commented
May 29, 2026
crosleyzack
commented
May 29, 2026
crosleyzack
commented
May 29, 2026
crosleyzack
commented
May 29, 2026
867ffd9 to
2cc549e
Compare
crosleyzack
commented
Jun 2, 2026
Comment on lines
+9
to
+19
| // OSVVulnerability extends the standard OSV Vulnerability model with additional | ||
| // fields used by Chainguard/Wolfi advisories that aren't yet in the osv-scanner library. | ||
| type OSVVulnerability struct { | ||
| models.Vulnerability | ||
|
|
||
| // TODO should this be put into upstream osv-scanner? | ||
| // Upstream contains IDs of upstream vulnerabilities that this advisory addresses. | ||
| // Per OSV spec, this is semantically correct for distro advisories that reference | ||
| // upstream CVEs. Included alongside "related" for backwards compatibility. | ||
| // See: https://ossf.github.io/osv-schema/ | ||
| Upstream []string `json:"upstream,omitempty"` |
Contributor
Author
There was a problem hiding this comment.
Should this be put into the upstream models.Vulnerability?
Contributor
There was a problem hiding this comment.
"github.com/google/osv-scanner/pkg/models" is deprecated and not getting updates any more. We might need to implement our own structs in this repo soon. I think this approach is ok for this PR.
df13edc to
8e81f7c
Compare
Signed-off-by: crosleyzack <mail@crosleyzack.com>
Signed-off-by: crosleyzack <mail@crosleyzack.com>
Signed-off-by: crosleyzack <mail@crosleyzack.com>
Signed-off-by: crosleyzack <mail@crosleyzack.com>
8e81f7c to
81fbdad
Compare
Signed-off-by: crosleyzack <mail@crosleyzack.com>
4817276 to
d9d6fde
Compare
crosleyzack
commented
Jun 10, 2026
Comment on lines
+41
to
+46
| // setArchFromPURL runs for every format: no SBOM decoder populates grype's | ||
| // pkg.Arch field directly, so without this the architecture qualifier on | ||
| // distro-keyed vulnerabilities can't filter by package arch. | ||
| enhancers := []Enhancer{setArchFromPURL} | ||
| if fmtID != syftjson.ID { | ||
| enhancers = purlEnhancers(applyChannel) | ||
| enhancers = append(enhancers, setUpstreamsFromPURL, setDistroFromPURL(applyChannel)) |
Contributor
Author
There was a problem hiding this comment.
we want normal scans to also include the arch information if available
crosleyzack
commented
Jun 10, 2026
Comment on lines
+38
to
+41
| // setArchFromPURL is applied for image scans because syft does not populate | ||
| // grype's pkg.Arch field directly — without this the architecture qualifier | ||
| // on distro-keyed vulnerabilities can't filter by package arch. | ||
| packages := FromCollection(s.Artifacts.Packages, s.Relationships, config.SynthesisConfig, setArchFromPURL) |
Contributor
Author
There was a problem hiding this comment.
include arch information in sbom scans
Signed-off-by: crosleyzack <mail@crosleyzack.com>
fc60746 to
6d183ed
Compare
Signed-off-by: crosleyzack <mail@crosleyzack.com>
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.
What
Add Chainguard transformer for new OSV feed. This also sets the architecture on packages so vuln matches can be filtered by architecture. Test images from Chainguard are currently being reviewed and should be in our GCR bucket soon.
Why
Allows grype to convert the vunnel output into vuln matches
Notes
Similar but updated version of #3255
Part of Chainguard issue INT-520