fix(vex): use installed version in PURLs and add distro qualifier for BOM-VEX correlation - #1552
Merged
robert-cronin merged 4 commits intoApr 24, 2026
Conversation
omercnet
requested review from
ashnamehrotra,
robert-cronin and
sozercan
as code owners
April 16, 2026 11:41
1 task
Codecov Reportβ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1552 +/- ##
==========================================
+ Coverage 40.27% 40.29% +0.02%
==========================================
Files 57 57
Lines 9817 9824 +7
==========================================
+ Hits 3954 3959 +5
- Misses 5585 5586 +1
- Partials 278 279 +1 β View full report in Codecov by Sentry. π New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Updates OpenVEX generation to improve correlation between Copaβs VEX output and Trivyβs input SBOM/report identifiers by aligning subcomponent PURLs with the installed (vulnerable) package version and increasing OS PURL specificity.
Changes:
- Generate OS and language subcomponent PURLs using
InstalledVersion(falling back toFixedVersionwhen missing). - Add a
distro={osType}-{osVersion}qualifier to OS package PURLs whenOS.Versionis available, usingurl.Valuesfor encoding. - Update and extend OpenVEX tests to reflect the new PURL behavior, including a new distro qualifier test.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/vex/openvex.go | Switches subcomponent PURL version selection to installed-version-first and adds optional distro qualifier via encoded query params. |
| pkg/vex/openvex_test.go | Updates expected PURLs to match installed versions and adds coverage for presence/absence of the distro qualifier. |
omercnet
force-pushed
the
fix/vex-purl-identifiers
branch
3 times, most recently
from
April 19, 2026 10:02
4a93190 to
0140378
Compare
omercnet
force-pushed
the
fix/vex-purl-identifiers
branch
from
April 22, 2026 12:41
0140378 to
08da98d
Compare
ashnamehrotra
approved these changes
Apr 22, 2026
ashnamehrotra
left a comment
Contributor
There was a problem hiding this comment.
LGTM after dependency fix
Subcomponent PURLs in generated OpenVEX documents now use the installed (vulnerable) package version instead of the fixed version, enabling consumers to correlate VEX statements back to the original scan/BOM. Also adds the distro qualifier (e.g. distro=debian-11.3) to OS package PURLs when OS version metadata is available, and uses url.Values for proper qualifier encoding. Fixes project-copacetic#1536 Signed-off-by: Omer <omer@descope.com>
omercnet
force-pushed
the
fix/vex-purl-identifiers
branch
from
April 23, 2026 05:11
08da98d to
2dd6f7f
Compare
This was referenced Apr 23, 2026
robert-cronin
merged commit Apr 24, 2026
b2c9dee
into
project-copacetic:main
134 of 141 checks passed
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
OpenVEX subcomponent PURLs now use the installed (vulnerable) package version instead of the fixed version, and include the
distroqualifier when OS version metadata is available.Motivation
Issue #1536 β Copa generates valid OpenVEX documents, but the identifiers cannot be mapped back to the input Trivy BOM/report because:
FixedVersioninstead ofInstalledVersionβ consumers cannot correlate VEX statements to the original BOM entriesdistroqualifier β reduces PURL specificity vs what Trivy produces (e.g.distro=debian-11.3)Changes
pkg/vex/openvex.go:InstalledVersion(falls back toFixedVersionif empty)distroqualifier ({OS.Type}-{OS.Version}) when OS version is presenturl.Valuesfor proper qualifier encodingpkg/vex/openvex_test.go:TestOpenVex_DistroQualifierβ verifies distro is included when OS.Version is set and omitted when emptyExample
Before (v0.13.0):
After:
The PURL now matches the input BOM entry, enabling automated VEX-BOM correlation.
Known limitations (follow-up)
epochqualifier is not yet extracted (would require parsing the version string; Trivy embeds epoch differently per distro)+vs%2B) follows Go'surl.Valuesbehavior, which may differ from Trivy's encodingTest plan
go test ./pkg/vex/...β all 16 tests passgo test ./pkg/report/...β existing report tests unaffectedTestOpenVex_DistroQualifiercovers both with/without OS.VersionFixes #1536