fix: use GetCveContentTypes instead of NewCveContentType (#1603)

This commit is contained in:
MaineK00n
2023-02-21 11:56:26 +09:00
committed by GitHub
parent 704492963c
commit 73f0adad95
5 changed files with 99 additions and 37 deletions

View File

@@ -411,7 +411,7 @@ func (v VulnInfo) Titles(lang, myFamily string) (values []CveContentStr) {
}
}
order := CveContentTypes{Trivy, Nvd, NewCveContentType(myFamily)}
order := append(CveContentTypes{Trivy, Nvd}, GetCveContentTypes(myFamily)...)
order = append(order, AllCveContetTypes.Except(append(order, Jvn)...)...)
for _, ctype := range order {
if conts, found := v.CveContents[ctype]; found {
@@ -458,7 +458,7 @@ func (v VulnInfo) Summaries(lang, myFamily string) (values []CveContentStr) {
}
}
order := CveContentTypes{Trivy, NewCveContentType(myFamily), Nvd, GitHub}
order := append(append(CveContentTypes{Trivy}, GetCveContentTypes(myFamily)...), Nvd, GitHub)
order = append(order, AllCveContetTypes.Except(append(order, Jvn)...)...)
for _, ctype := range order {
if conts, found := v.CveContents[ctype]; found {
@@ -550,7 +550,7 @@ func (v VulnInfo) Cvss3Scores() (values []CveContentCvss) {
}
}
for _, ctype := range []CveContentType{Debian, DebianSecurityTracker, Ubuntu, Amazon, Trivy, GitHub, WpScan} {
for _, ctype := range []CveContentType{Debian, DebianSecurityTracker, Ubuntu, UbuntuAPI, Amazon, Trivy, GitHub, WpScan} {
if conts, found := v.CveContents[ctype]; found {
for _, cont := range conts {
if cont.Cvss3Severity != "" {
@@ -728,7 +728,7 @@ func severityToCvssScoreRange(severity string) string {
return "7.0-8.9"
case "MODERATE", "MEDIUM":
return "4.0-6.9"
case "LOW":
case "LOW", "NEGLIGIBLE":
return "0.1-3.9"
}
return "None"
@@ -746,6 +746,10 @@ func severityToCvssScoreRange(severity string) string {
// Critical, High, Medium, Low
// https://wiki.ubuntu.com/Bugs/Importance
// https://people.canonical.com/~ubuntu-security/cve/priority.html
//
// Ubuntu CVE Tracker
// Critical, High, Medium, Low, Negligible
// https://people.canonical.com/~ubuntu-security/priority.html
func severityToCvssScoreRoughly(severity string) float64 {
switch strings.ToUpper(severity) {
case "CRITICAL":
@@ -754,7 +758,7 @@ func severityToCvssScoreRoughly(severity string) float64 {
return 8.9
case "MODERATE", "MEDIUM":
return 6.9
case "LOW":
case "LOW", "NEGLIGIBLE":
return 3.9
}
return 0