vulnsrc_rhel: rhsa_ID by default
If no CVE is present, create a vulnerability with rhsa ID
This commit is contained in:
parent
4ab98cfe54
commit
ac86a36740
@ -197,6 +197,8 @@ func parseRHSA(ovalReader io.Reader) (vulnerabilities []database.VulnerabilityWi
|
|||||||
for _, definition := range ov.Definitions {
|
for _, definition := range ov.Definitions {
|
||||||
pkgs := toFeatures(definition.Criteria)
|
pkgs := toFeatures(definition.Criteria)
|
||||||
if len(pkgs) > 0 {
|
if len(pkgs) > 0 {
|
||||||
|
|
||||||
|
// Init vulnerability
|
||||||
vulnerability := database.VulnerabilityWithAffected{
|
vulnerability := database.VulnerabilityWithAffected{
|
||||||
Vulnerability: database.Vulnerability{
|
Vulnerability: database.Vulnerability{
|
||||||
Severity: severity(definition),
|
Severity: severity(definition),
|
||||||
@ -207,11 +209,15 @@ func parseRHSA(ovalReader io.Reader) (vulnerabilities []database.VulnerabilityWi
|
|||||||
vulnerability.Affected = append(vulnerability.Affected, p)
|
vulnerability.Affected = append(vulnerability.Affected, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
// One vulnerability by CVE
|
// Only RHSA is present
|
||||||
for _, reference := range definition.References {
|
if len(definition.References) == 1 {
|
||||||
if reference.Source == "CVE" {
|
vulnerability.Name = rhsaName(definition)
|
||||||
vulnerability.Name = reference.ID
|
vulnerability.Link = definition.References[0].URI
|
||||||
vulnerability.Link = reference.URI
|
vulnerabilities = append(vulnerabilities, vulnerability)
|
||||||
|
} else {
|
||||||
|
for _, reference := range definition.References[1:] {
|
||||||
|
vulnerability.Name = name(reference)
|
||||||
|
vulnerability.Link = link(reference)
|
||||||
vulnerabilities = append(vulnerabilities, vulnerability)
|
vulnerabilities = append(vulnerabilities, vulnerability)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,3 +386,15 @@ func severity(def definition) database.Severity {
|
|||||||
return database.UnknownSeverity
|
return database.UnknownSeverity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func name(ref reference) string {
|
||||||
|
return ref.ID
|
||||||
|
}
|
||||||
|
|
||||||
|
func link(ref reference) string {
|
||||||
|
return ref.URI
|
||||||
|
}
|
||||||
|
|
||||||
|
func rhsaName(def definition) string {
|
||||||
|
return strings.TrimSpace(def.Title[:strings.Index(def.Title, ": ")])
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user