fix: carry SBOM annotations in metadata-only GetSBOM payload - #53
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughSBOM metadata is extended with a new annotations map field to support annotation-based branching in metadata-only probes. The proto schema, API documentation, and round-trip test coverage are updated together to define, document, and verify the new field's behavior. ChangesSBOM Metadata Annotations
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
5288fa3 to
995a35f
Compare
GetSBOMStream's metadata-only path returned an SBOMMetadata that omitted the SBOM's Kubernetes annotations. Consumers that only need to branch on annotations (status, tool-version, node-name, scanner-memory-limit) were therefore forced onto the full-fetch path -- downloading and UnmarshalSBOM-ing the entire blob just to read a handful of strings (e.g. node-agent's GetSBOMMeta). Add a `map<string,string> annotations` field to SBOMMetadata so a metadata_only=true fetch is sufficient for annotation-only decisions. Regenerated the gogo bindings via `make proto` and extended the metadata-only round-trip test to assert annotations survive the path. Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
995a35f to
4375e76
Compare
Problem
GetSBOMStream's metadata-only path (metadata_only=true) returns anSBOMMetadatathat carries onlyimage_digest,syft_version,source,blob_size_bytes,created_at, andlast_referenced_at— but no annotations.Consumers that only need to branch on the SBOM's Kubernetes annotations (
status,tool-version,node-name,scanner-memory-limit, …) are therefore forced onto the full-fetch path: node-agent'sGetSBOMMetadownloads the entire blob andUnmarshalSBOMs it just to read a handful of strings.Fix
Add a generic
map<string, string> annotationsfield (field7) to theSBOMMetadataproto message. It maps 1:1 ontoSBOMSyft.ObjectMeta.Annotations, so ametadata_only=truefetch becomes sufficient for any annotation-only decision — no per-annotation proto churn as new keys are added.storage_service.proto: newannotationsfield with doc comment.storage_service.pb.go: regenerated viamake proto(gogo bindings); the gRPC stub regenerated identically.storageclient.go:GetSBOMStreamdoc comment now notes annotations are available on the metadata-only path.storageclient_test.go: the metadata-only round-trip subtest now asserts annotations survive themetadata_onlypath end-to-end over bufconn.This is a backward-compatible, additive proto change (new field number, no renumbering).
Follow-ups (separate repos)
SBOMMetadata.annotationsfrom the stored SBOM row onGetSBOMStream.GetSBOMMetatometadata_only=trueand reconstructSBOMSyft.Annotationsfrommd.SbomMetadata.Annotationsinstead of fetching the full blob.Testing
go build ./...andgo test ./pkg/client/v1/...pass.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests