ROX-32846: Add repository-to-CPE mapping API to indexer#18705
ROX-32846: Add repository-to-CPE mapping API to indexer#18705
Conversation
|
Images are ready for the commit at 9bff2aa. To use with deploy scripts, first |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dc/sbom-ingest-central-api #18705 +/- ##
==============================================================
- Coverage 49.20% 49.16% -0.04%
==============================================================
Files 2659 2661 +2
Lines 199858 200014 +156
==============================================================
+ Hits 98344 98345 +1
- Misses 94082 94238 +156
+ Partials 7432 7431 -1
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
| func (u *Updater) Get(ctx context.Context, c *http.Client) (any, error) { | ||
| var err error | ||
| if u.url != "" && u.reqRate.Allow() { | ||
| slog.DebugContext(ctx, "got unlucky, updating mapping file") | ||
| err = u.Fetch(ctx, c) | ||
| if err != nil { | ||
| slog.ErrorContext(ctx, "error updating mapping file", "reason", err) | ||
| } | ||
| } | ||
|
|
||
| return u.value.Load(), err | ||
| } |
There was a problem hiding this comment.
super nit: non-blocking and realize this is taken directly from quay/claircore - this appears to be the first introduction of slog in StackRox - now using slog, zlog, StackRox specific pkg/logging/logging.go, and maybe more - we may benefit from focusing this a bit in the future.
There was a problem hiding this comment.
While I think we should definitely standardize on slog and maybe have StackRox-specific provider, it wasn't my intent to introduce it here. Good catch.
| if len(initValue.Data) == 0 { | ||
| if _, err := updater.Get(ctx, client); err != nil { | ||
| zlog.Warn(ctx).Err(err).Msg("failed to fetch initial repo-to-CPE mapping") | ||
| } | ||
| } |
There was a problem hiding this comment.
nit: IIUC the first call to updater.Get() will always try to Fetch from the URL regardless if initial data was loaded - if it aligns w/ intent could remove the len() check and always call updater.Get().
3a3b390 to
9bff2aa
Compare
01e65a6 to
09f9e5f
Compare
|
@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. |
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.
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.
9bff2aa to
0ea00c1
Compare
🚀 Build Images ReadyImages are ready for commit 0ea00c1. To use with deploy scripts: export MAIN_IMAGE_TAG=4.11.x-612-g0ea00c111c |
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. This mapping will be needed by the matcher's ScanSBOM API to enrich RHEL packages with CPE information during SBOM vulnerability scanning.
Alternatives
PR stack:
masterUser-facing documentation
Testing and quality
Automated testing
No automated testing. Will follow up in ROX-27690.
How I validated my change
ROX_SBOM_SCANNINGfeature flag: