Skip to content

Commit

Permalink
fix(models/cvecontents): use cve content type Alma, Rocky
Browse files Browse the repository at this point in the history
  • Loading branch information
MaineK00n committed Dec 13, 2024
1 parent d269658 commit a13ebb0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
6 changes: 5 additions & 1 deletion detector/vuls2/vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,18 @@ func advisoryReferenceSource(family string, r referenceTypes.Reference) string {
switch family {
case constant.RedHat, constant.CentOS:
return "RHSA"
case constant.Alma:
return "ALSA"
case constant.Rocky:
return "RLSA"
default:
return r.Source
}
}

func cveContentSourceLink(ccType models.CveContentType, v vulnerabilityTypes.Vulnerability) string {
switch ccType {
case models.RedHat:
case models.RedHat, models.Alma, models.Rocky:
return fmt.Sprintf("https://access.redhat.com/security/cve/%s", v.Content.ID)
default:
return ""
Expand Down
20 changes: 18 additions & 2 deletions models/cvecontents.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,12 @@ func NewCveContentType(name string) CveContentType {
return Nvd
case "jvn":
return Jvn
case "redhat", "centos", "alma", "rocky":
case "redhat", "centos":
return RedHat
case "alma":
return Alma
case "rocky":
return Rocky
case "fedora":
return Fedora
case "oracle":
Expand Down Expand Up @@ -401,8 +405,12 @@ func NewCveContentType(name string) CveContentType {
// GetCveContentTypes return CveContentTypes
func GetCveContentTypes(family string) []CveContentType {
switch family {
case constant.RedHat, constant.CentOS, constant.Alma, constant.Rocky:
case constant.RedHat, constant.CentOS:
return []CveContentType{RedHat, RedHatAPI}
case constant.Alma:
return []CveContentType{Alma}
case constant.Rocky:
return []CveContentType{Rocky}
case constant.Fedora:
return []CveContentType{Fedora}
case constant.Oracle:
Expand Down Expand Up @@ -443,6 +451,12 @@ const (
// RedHatAPI is RedHat
RedHatAPI CveContentType = "redhat_api"

// Alma is Alma
Alma CveContentType = "alma"

// Rocky is Rocky
Rocky CveContentType = "rocky"

// DebianSecurityTracker is Debian Security tracker
DebianSecurityTracker CveContentType = "debian_security_tracker"

Expand Down Expand Up @@ -578,6 +592,8 @@ var AllCveContetTypes = CveContentTypes{
Fortinet,
RedHat,
RedHatAPI,
Alma,
Rocky,
Debian,
DebianSecurityTracker,
Ubuntu,
Expand Down
2 changes: 1 addition & 1 deletion models/vulninfos.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ func (v VulnInfo) Cvss2Scores() (values []CveContentCvss) {

// Cvss3Scores returns CVSS V3 Score
func (v VulnInfo) Cvss3Scores() (values []CveContentCvss) {
order := append([]CveContentType{RedHatAPI, RedHat, SUSE, Microsoft, Fortinet, Nvd, Mitre, Jvn}, GetCveContentTypes(string(Trivy))...)
order := append([]CveContentType{RedHatAPI, RedHat, Rocky, SUSE, Microsoft, Fortinet, Nvd, Mitre, Jvn}, GetCveContentTypes(string(Trivy))...)
for _, ctype := range order {
if conts, found := v.CveContents[ctype]; found {
for _, cont := range conts {
Expand Down

0 comments on commit a13ebb0

Please sign in to comment.