mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-26 06:37:07 +00:00
feat(scanner): match bypasses and merge findings across advisory aliases
Scanners report one advisory under different ids, such as a GHSA id from OSV and the CVE id from Trivy. Findings now carry an aliases list. The merge folds findings that share any id into one finding. A bypass for any id of a finding now covers it. Stored findings without aliases still load and match by their own id.
This commit is contained in:
@@ -182,6 +182,7 @@ func (s *Scanner) convertResult(auditResult *PipAuditResult, registry, packageNa
|
||||
Description: vuln.Description,
|
||||
References: []string{fmt.Sprintf("https://osv.dev/vulnerability/%s", vuln.ID)},
|
||||
FixedIn: fixedIn,
|
||||
Aliases: metadata.NormalizeAliases(vuln.ID, vuln.Aliases...),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,3 +140,13 @@ func TestScanSkipsOtherRegistries(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, metadata.ScanStatusClean, res.Status)
|
||||
}
|
||||
|
||||
func TestFindingsKeepThePipAuditAliases(t *testing.T) {
|
||||
audit := &PipAuditResult{Dependencies: []PipDependency{{Name: "requests", Version: "2.19.0", Vulns: []PipVuln{{
|
||||
ID: "PYSEC-2018-28", Aliases: []string{"CVE-2018-18074", "GHSA-x84v-xcm2-53pg", "pysec-2018-28"},
|
||||
}}}}}
|
||||
|
||||
res := New(config.PipAuditConfig{}).convertResult(audit, "pypi", "requests", "2.19.0")
|
||||
|
||||
assert.Equal(t, []string{"CVE-2018-18074", "GHSA-x84v-xcm2-53pg"}, res.Vulnerabilities[0].Aliases)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user