Skip to content

rhcc: fix matching for timestamp-based versions#1873

Open
BradLugo wants to merge 2 commits into
quay:mainfrom
BradLugo:rhcc-timestamp-matching-fix
Open

rhcc: fix matching for timestamp-based versions#1873
BradLugo wants to merge 2 commits into
quay:mainfrom
BradLugo:rhcc-timestamp-matching-fix

Conversation

@BradLugo
Copy link
Copy Markdown
Contributor

rpmver.Parse requires a string in the EVR format (version-release, with
at least one dash). For newer (e.g., Konflux-built) Red Hat images, the
rhcc detector parses a Unix timestamp-based version (e.g., "1744596866")
from the labels.json file and the VEX parser extracts matching timestamp
tags from OCI PURLs, neither of which contain a dash. This caused
rpmver.Parse to reject them with "missing separators", preventing any
vulnerability matching for containers using the new labels.json
metadata.

These changes normalize version strings in the matcher by appending "-0"
when no dash (release) is present, consistent with what rhctag.toEVR()
already does.

@BradLugo BradLugo requested a review from a team as a code owner May 13, 2026 23:12
@BradLugo BradLugo requested review from hdonnay and removed request for a team May 13, 2026 23:12
@BradLugo
Copy link
Copy Markdown
Contributor Author

BradLugo commented May 13, 2026

This seemed like the simplest fix. The alternative would be to adjust the versioning on both sides (i.e., the rhcc detector/IndexReport and the VEX updater/Vulnerability). This way, we can adjust the matcher without requiring any database changes for claircore instances that may already have these non-EVR string versions in their databases. I'm definitely open to alternatives, though.

@BradLugo
Copy link
Copy Markdown
Contributor Author

It just occurred to me that this wouldn't work for unfixed versions. Converting to draft and giving that a think.

@BradLugo BradLugo marked this pull request as draft May 13, 2026 23:31
@BradLugo BradLugo force-pushed the rhcc-timestamp-matching-fix branch 2 times, most recently from 53ad7e9 to 42d16f4 Compare May 13, 2026 23:47
@BradLugo
Copy link
Copy Markdown
Contributor Author

I went the easy route 🤷 I think we should consider throwing an error for rpmver.Parse("-0").

There is an interesting situation with these changes: the rhcc matcher previously didn't match unfixed vulnerabilities. I had thought it was resolved after 1c411ec (#1770 (comment)), but that doesn't seem to be the case.

@BradLugo BradLugo marked this pull request as ready for review May 13, 2026 23:51
@BradLugo BradLugo force-pushed the rhcc-timestamp-matching-fix branch from 42d16f4 to 7d973f0 Compare May 14, 2026 16:34
BradLugo added 2 commits May 14, 2026 09:34
rpmver.Parse requires a string in the EVR format (version-release, with
at least one dash). For newer (e.g., Konflux-built) Red Hat images, the
rhcc detector parses a Unix timestamp-based version (e.g., "1744596866")
from the labels.json file and the VEX parser extracts matching timestamp
tags from OCI PURLs, neither of which contain a dash. This caused
rpmver.Parse to reject them with "missing separators", preventing any
vulnerability matching for containers using the new labels.json
metadata.

These changes normalize version strings in the matcher by appending "-0"
when no dash (release) is present, consistent with what rhctag.toEVR()
already does.

Signed-off-by: Brad Lugo <blugo@redhat.com>
Signed-off-by: Brad Lugo <blugo@redhat.com>
@BradLugo BradLugo force-pushed the rhcc-timestamp-matching-fix branch from 7d973f0 to 7d095fb Compare May 14, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant