Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion updater/fetchers/apps/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var vulCache utils.Set = utils.NewSet()
var cveCalibrate map[string][]common.AppModuleVersion = make(map[string][]common.AppModuleVersion)

// Sometimes source doesn't remove withdrawn CVEs
var withdrawnCVEs = map[string]struct{}{"CVE-2021-23334": {}, "CVE-2024-4109": {}}
var withdrawnCVEs = map[string]struct{}{"CVE-2021-23334": {}, "CVE-2024-4109": {}, "CVE-2026-33817": {}}

// This is a workaround to use import to control app db generation
type AppFetcher struct{}
Expand Down Expand Up @@ -71,6 +71,10 @@ func (f *AppFetcher) FetchUpdate() (resp updater.AppFetcherResponse, err error)
delete(vulMap, key)
continue
}
if updater.ShouldSkipDescription(mv.Description) {
delete(vulMap, key)
continue
}
// Keep all CWE and GHSA vulnerabilities for now.
if !strings.HasPrefix(mv.VulName, "CWE-") && !strings.HasPrefix(mv.VulName, "GHSA-") {
if s := strings.Index(mv.VulName, "-"); s != -1 {
Expand Down
3 changes: 3 additions & 0 deletions updater/fetchers/ubuntu/ubuntu.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ func (fetcher *UbuntuFetcher) FetchUpdate() (resp updater.FetcherResponse, err e

// Add the vulnerability to the response.
upstreamCalibration(&v)
if updater.ShouldSkipDescription(v.Description) {
continue
}
if len(v.FixedIn) > 0 || fetcher.CvesIncludeGoVuln.Contains(v.Name) {
resp.Vulnerabilities = append(resp.Vulnerabilities, v)
}
Expand Down
19 changes: 19 additions & 0 deletions updater/filter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package updater

import "strings"

var skippedDescriptionMarkers = []string{
"rejected reason",
"withdrawn advisory",
}

func ShouldSkipDescription(description string) bool {
lowerDescription := strings.ToLower(description)
for _, marker := range skippedDescriptionMarkers {
if strings.Contains(lowerDescription, marker) {
return true
}
}

return false
}
29 changes: 29 additions & 0 deletions updater/filter_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package updater

import "testing"

func TestShouldSkipDescription(t *testing.T) {
cases := []struct {
description string
want bool
}{
{
description: "Rejected reason: CVE confirmed to be a false positive",
want: true,
},
{
description: "Withdrawn Advisory: go.etcd.io/bbolt affected by index out-of-range vulnerability",
want: true,
},
{
description: "Regular advisory description",
want: false,
},
}

for _, tc := range cases {
if got := ShouldSkipDescription(tc.description); got != tc.want {
t.Fatalf("ShouldSkipDescription(%q) = %v, want %v", tc.description, got, tc.want)
}
}
}
Loading