Skip to content

Commit

Permalink
fix: issue-1168, remove duplicate CVE (#1230)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael12312 committed Aug 27, 2024
1 parent 644581f commit 8edb053
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/integration/trivy/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,21 @@ func (TrivyAnalyzer) analyzeVulnerabilityReports(a common.Analyzer) ([]common.Re

// For each pod there may be multiple vulnerabilities
var failures []common.Failure
distinctFailures := make(map[string]common.Failure)
for _, vuln := range report.Report.Vulnerabilities {
if vuln.Severity == "CRITICAL" {
// get the vulnerability ID
// get the vulnerability description
failures = append(failures, common.Failure{
Text: fmt.Sprintf("critical Vulnerability found ID: %s (learn more at: %s)", vuln.VulnerabilityID, vuln.PrimaryLink),
text := fmt.Sprintf("critical Vulnerability found ID: %s (learn more at: %s)", vuln.VulnerabilityID, vuln.PrimaryLink)
distinctFailures[text] = common.Failure{
Text: text,
Sensitive: []common.Sensitive{},
})
}
}
}
for _, v := range distinctFailures {
failures = append(failures, v)
}
if len(failures) > 0 {
preAnalysis[fmt.Sprintf("%s/%s", report.Namespace,
report.Name)] = common.PreAnalysis{
Expand Down

0 comments on commit 8edb053

Please sign in to comment.