@@ -88,23 +88,25 @@ type MissingRule struct {
8888
8989// FailingRule represents a rule that is present in the VSA but failed validation
9090type FailingRule struct {
91- RuleID string `json:"rule_id"`
92- Package string `json:"package"`
93- Message string `json:"message"`
94- Reason string `json:"reason"`
95- Title string `json:"title,omitempty"`
96- Description string `json:"description,omitempty"`
97- Solution string `json:"solution,omitempty"`
91+ RuleID string `json:"rule_id"`
92+ Package string `json:"package"`
93+ Message string `json:"message"`
94+ Reason string `json:"reason"`
95+ Title string `json:"title,omitempty"`
96+ Description string `json:"description,omitempty"`
97+ Solution string `json:"solution,omitempty"`
98+ ComponentImage string `json:"component_image,omitempty"` // The specific container image this violation relates to
9899}
99100
100101// RuleResult represents a rule result extracted from the VSA
101102type RuleResult struct {
102- RuleID string `json:"rule_id"`
103- Status string `json:"status"` // "success", "failure", "warning", "skipped", "exception"
104- Message string `json:"message"`
105- Title string `json:"title,omitempty"`
106- Description string `json:"description,omitempty"`
107- Solution string `json:"solution,omitempty"`
103+ RuleID string `json:"rule_id"`
104+ Status string `json:"status"` // "success", "failure", "warning", "skipped", "exception"
105+ Message string `json:"message"`
106+ Title string `json:"title,omitempty"`
107+ Description string `json:"description,omitempty"`
108+ Solution string `json:"solution,omitempty"`
109+ ComponentImage string `json:"component_image,omitempty"` // The specific container image this result relates to
108110}
109111
110112// VSARuleValidatorImpl implements VSARuleValidator with comprehensive validation logic
@@ -161,9 +163,10 @@ func (v *VSARuleValidatorImpl) extractRuleResults(vsaRecords []VSARecord) (map[s
161163 ruleID := v .extractRuleID (success )
162164 if ruleID != "" {
163165 ruleResults [ruleID ] = append (ruleResults [ruleID ], RuleResult {
164- RuleID : ruleID ,
165- Status : "success" ,
166- Message : success .Message ,
166+ RuleID : ruleID ,
167+ Status : "success" ,
168+ Message : success .Message ,
169+ ComponentImage : component .ContainerImage ,
167170 })
168171 }
169172 }
@@ -173,12 +176,13 @@ func (v *VSARuleValidatorImpl) extractRuleResults(vsaRecords []VSARecord) (map[s
173176 ruleID := v .extractRuleID (violation )
174177 if ruleID != "" {
175178 ruleResults [ruleID ] = append (ruleResults [ruleID ], RuleResult {
176- RuleID : ruleID ,
177- Status : "failure" ,
178- Message : violation .Message ,
179- Title : v .extractMetadataString (violation , "title" ),
180- Description : v .extractMetadataString (violation , "description" ),
181- Solution : v .extractMetadataString (violation , "solution" ),
179+ RuleID : ruleID ,
180+ Status : "failure" ,
181+ Message : violation .Message ,
182+ Title : v .extractMetadataString (violation , "title" ),
183+ Description : v .extractMetadataString (violation , "description" ),
184+ Solution : v .extractMetadataString (violation , "solution" ),
185+ ComponentImage : component .ContainerImage ,
182186 })
183187 }
184188 }
@@ -188,9 +192,10 @@ func (v *VSARuleValidatorImpl) extractRuleResults(vsaRecords []VSARecord) (map[s
188192 ruleID := v .extractRuleID (warning )
189193 if ruleID != "" {
190194 ruleResults [ruleID ] = append (ruleResults [ruleID ], RuleResult {
191- RuleID : ruleID ,
192- Status : "warning" ,
193- Message : warning .Message ,
195+ RuleID : ruleID ,
196+ Status : "warning" ,
197+ Message : warning .Message ,
198+ ComponentImage : component .ContainerImage ,
194199 })
195200 }
196201 }
@@ -287,13 +292,14 @@ func (v *VSARuleValidatorImpl) compareRules(vsaRuleResults map[string][]RuleResu
287292 if ruleResult .Status == "failure" {
288293 // Rule failed validation - this is a failure
289294 result .FailingRules = append (result .FailingRules , FailingRule {
290- RuleID : ruleID ,
291- Package : v .extractPackageFromRuleID (ruleID ),
292- Message : ruleResult .Message ,
293- Reason : "Rule failed validation in VSA" ,
294- Title : ruleResult .Title ,
295- Description : ruleResult .Description ,
296- Solution : ruleResult .Solution ,
295+ RuleID : ruleID ,
296+ Package : v .extractPackageFromRuleID (ruleID ),
297+ Message : ruleResult .Message ,
298+ Reason : "Rule failed validation in VSA" ,
299+ Title : ruleResult .Title ,
300+ Description : ruleResult .Description ,
301+ Solution : ruleResult .Solution ,
302+ ComponentImage : ruleResult .ComponentImage ,
297303 })
298304 } else if ruleResult .Status == "success" || ruleResult .Status == "warning" {
299305 // Rule passed or has warning - both are acceptable
0 commit comments