ROX-32846: Add repository-to-CPE mapping API to indexer#18705
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #18705 +/- ##
==========================================
+ Coverage 49.56% 49.58% +0.02%
==========================================
Files 2794 2797 +3
Lines 212573 212821 +248
==========================================
+ Hits 105359 105530 +171
- Misses 99483 99557 +74
- Partials 7731 7734 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1d03f53 to
3a3b390
Compare
3a3b390 to
9bff2aa
Compare
01e65a6 to
09f9e5f
Compare
vikin91
left a comment
There was a problem hiding this comment.
This change looks like it would not affect any scanning feature developed in the Sensor team, so it is good to go.
Feel free to request a re-review once the CI checks are resolved.
9bff2aa to
0ea00c1
Compare
🚀 Build Images ReadyImages are ready for commit df7bf05. To use with deploy scripts: export MAIN_IMAGE_TAG=4.11.x-867-gdf7bf05676 |
0ea00c1 to
53ef512
Compare
8f167dd to
6a3585d
Compare
6a3585d to
113ae4b
Compare
|
/retest |
4d2e343 to
4733fa8
Compare
|
Gonna take another look at repo2cpe updater again tomorrow morning. I think there are some slight improvements we can make before merging. |
|
Ok, the repo2cpe.Updater kind of got away from me, but I like it 🤷 Happy to make it simpler if we don't want all that complexity. Should note that I believe a lot of this will be ripped out at some point for a better Claircore API. |
3a847e9 to
43fa702
Compare
|
Rebasing and incorporating #20259. |
|
@BradLugo: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Adds a new RPC, GetRepositoryToCPEMapping, to the Indexer service that returns the Red Hat repository-to-CPE mapping used for RHEL package vulnerability matching. This mapping will be needed by the matcher's ScanSBOM API to enrich RHEL packages with CPE information during SBOM vulnerability scanning. Assisted-by: Claude Opus 4.5 (200k) <noreply@anthropic.com>
The indexer now acts as a simple proxy to upstream (Central/Red Hat), while the matcher caches the data locally with periodic refresh. Key changes: - Add conditional fetch support (If-Modified-Since) to gRPC API - New RepositoryToCPEFetcher in indexer as a stateless proxy - New repo2cpe.Updater in matcher with lazy initialization - Only fetches data on first Get() call - Background refresh every 24 hours using conditional requests - Close() method for graceful shutdown - Remove httputil.Updater and RepositoryToCPEUpdater (no longer needed) Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The repo2cpe updater now initializes lazily on first Get() call instead of requiring an explicit Start(). This avoids fetching mapping data and starting background refresh for matchers that never use it. Changes: - Use sync.Once to trigger init on first access - Replace blocking Start() with Close() for lifecycle management - Use done channel instead of context for shutdown signaling Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Particularly to avoid panics for logging during testing.
Don't reach out to WAN by default. This was a result of copy+pasting the Claircore implementation at the beginning of this branch.
Also changes the related log warning to an error.
Mostly hardening the repo2cpe.Updater lifecycle, adjust a log, and nil checking.
43fa702 to
566e043
Compare

Description
Adds a new RPC,
GetRepositoryToCPEMapping, to the Indexer service that returns the Red Hat repository-to-CPE mapping used for RHEL package vulnerability matching. The matcher's ScanSBOM API will need this mapping to enrich RHEL packages with CPE information during SBOM vulnerability scanning.The Indexer acts as a stateless proxy to the repository-to-CPE mapping file from Central, while the matcher caches the data locally with periodic background refresh. The
GetRepositoryToCPEMappingsupports conditional fetch viaIf-Modified-Sinceto minimize data transfer on refresh.Alternatives
PR stack:
masterUser-facing documentation
Testing and quality
Automated testing
How I validated my change
ROX_SBOM_SCANNINGfeature flag: