@@ -213,19 +213,21 @@ func ruleGrypeKEVLimit(config *Config, report *artifacts.GrypeReportMin, catalog
213
213
slog .Error ("kev limit enabled but no catalog data exists" )
214
214
return false
215
215
}
216
- foundKevMatch := false
216
+ badCVEs := make ([] string , 0 )
217
217
// Check if vulnerability is in the KEV Catalog
218
218
for _ , vulnerability := range report .Matches {
219
219
inKEVCatalog := slices .ContainsFunc (catalog .Vulnerabilities , func (kevVul kev.Vulnerability ) bool {
220
220
return kevVul .CveID == vulnerability .Vulnerability .ID
221
221
})
222
222
if inKEVCatalog {
223
- slog . Warn ( "Matched to KEV Catalog" ,
224
- "vulnerability" , vulnerability . Vulnerability . ID )
225
- foundKevMatch = true
223
+ badCVEs = append ( badCVEs , vulnerability . Vulnerability . ID )
224
+ slog . Warn ( "cve found in kev catalog" ,
225
+ "cve_id" , vulnerability . Vulnerability . ID )
226
226
}
227
227
}
228
- if foundKevMatch {
228
+ if len (badCVEs ) > 0 {
229
+ slog .Error ("cve(s) found in kev catalog" ,
230
+ "vulnerabilities" , len (badCVEs ), "kev_catalog_count" , len (catalog .Vulnerabilities ))
229
231
return false
230
232
}
231
233
slog .Info ("kev limit validated, no cves in catalog" ,
@@ -242,20 +244,22 @@ func ruleCyclonedxKEVLimit(config *Config, report *artifacts.CyclonedxReportMin,
242
244
slog .Error ("kev limit enabled but no catalog data exists" , "artifact" , "cyclonedx" )
243
245
return false
244
246
}
245
- foundKevMatch := false
247
+ badCVEs := make ([] string , 0 )
246
248
// Check if vulnerability is in the KEV Catalog
247
249
for _ , vulnerability := range report .Vulnerabilities {
248
250
inKEVCatalog := slices .ContainsFunc (catalog .Vulnerabilities , func (kevVul kev.Vulnerability ) bool {
249
251
return strings .EqualFold (kevVul .CveID , vulnerability .ID )
250
252
})
251
253
252
254
if inKEVCatalog {
253
- slog . Warn ( "Matched to KEV Catalog" ,
254
- "vulnerability" , vulnerability . ID )
255
- foundKevMatch = true
255
+ badCVEs = append ( badCVEs , vulnerability . ID )
256
+ slog . Warn ( "cve found in kev catalog" ,
257
+ "cve_id" , vulnerability . ID )
256
258
}
257
259
}
258
- if foundKevMatch {
260
+ if len (badCVEs ) > 0 {
261
+ slog .Error ("cve(s) found in kev catalog" ,
262
+ "vulnerabilities" , len (badCVEs ), "kev_catalog_count" , len (catalog .Vulnerabilities ))
259
263
return false
260
264
}
261
265
slog .Info ("kev limit validated, no cves in catalog" ,
0 commit comments