feat: add suppression provenance fields to IgnoreRule (#357) - #358
Conversation
Signed-off-by: Shreya2005-2005 <bhakatmistu@email.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesIgnoreRule provenance
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/apis/softwarecomposition/v1beta1/grype_types.go`:
- Around line 101-107: Regenerate the protobuf bindings for the type containing
SourceKind, SourceName, SourceNamespace, Justification, and ImpactStatement so
generated.pb.go marshals and unmarshals protobuf fields 4–8. Add a round-trip
test covering all five fields and verify their values are preserved.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 402ec1a4-496e-4b12-b38b-42b13cff2c5f
📒 Files selected for processing (3)
pkg/apis/softwarecomposition/grype_types.gopkg/apis/softwarecomposition/v1beta1/grype_types.gopkg/apis/softwarecomposition/v1beta1/grype_types_test.go
Code Review SummaryThere is a blocker before this PR is ready to merge: Blocker: Generated Code Out-of-Sync (Protobuf & API Conversion)
|
… provenance fields Signed-off-by: Shreya2005-2005 <bhakatmistu@email.com>
|
@matthyx all 3 addressed:
Full build + |
matthyx
left a comment
There was a problem hiding this comment.
LGTM! All 3 issues (protobuf codec, conversion & openapi codegen, and protobuf round-trip tests) have been fully addressed and verified.
Overview
IgnoreRulehad only 3 fields (Vulnerability,FixState,Package),with no way to record why or by what a vulnerability was suppressed.
kubevuln's recently-merged suppression-provenance system (kubevuln#488,
merged as kubevuln#495) already builds a real record of this -which
SecurityException matched, its scope, and its stated justification -but
that PR's own code comment confirms it can only log this, never store it,
because
IgnoreRulehas no fields for it.This also affects the External VEX Ingestion project (kubevuln#387),
whose deliverables explicitly require "recording which document/statement
caused each suppression" - the same missing capability, for VEX
statements instead of SecurityExceptions.
Before / After
Before:
After: the same code compiles, and the field round-trips correctly
through both JSON and DeepCopy.
Changes
Add generic, reusable provenance fields to
IgnoreRule, in both theinternal and
v1beta1versions:No deepcopy regeneration needed - the generated
DeepCopyIntodoes afull value copy (
*out = *in) before handling the one pointer field(
Package), so it already covers these new plain string fieldscorrectly. Verified with a test.
Testing
pkg/apis/softwarecomposition/v1beta1/grype_types_test.go(new):confirms the new fields survive a JSON round-trip, and confirms
DeepCopycorrectly copies them without aliasing the original.Full repo build and
go test ./...pass with no failures.Follow-up
Once this is merged and released, a follow-up PR in
kubevulnwill wirebuildSuppressionAttributes/logSuppression(from #495) to actuallypopulate these new fields on
IgnoreRule, instead of only logging them —closing the gap that PR's own comment flagged.
Related issues/PRs:
Checklist before requesting a review