Skip to content

Commit d124dea

Browse files
authored
fix(vulnfeeds): empty affected ranges being added (#3981)
1 parent cf83a75 commit d124dea

File tree

3 files changed

+7
-67
lines changed

3 files changed

+7
-67
lines changed

vulnfeeds/cmd/debian/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ func generateOSVFromDebianTracker(debianData DebianSecurityTrackerData, debianRe
140140
if release.Status == "resolved" {
141141
pkgInfo.VersionInfo.AffectedVersions = []models.AffectedVersion{{Fixed: release.FixedVersion}}
142142
}
143-
v.AddPkgInfo(pkgInfo)
143+
144+
if len(pkgInfo.VersionInfo.AffectedVersions) > 0 {
145+
v.AddPkgInfo(pkgInfo)
146+
}
144147
}
145148
}
146149
}

vulnfeeds/cmd/debian/main_test.go

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -75,31 +75,14 @@ func TestGenerateOSVFromDebianTracker(t *testing.T) {
7575
"trixie": "13",
7676
}
7777
cveStuff := map[cves.CVEID]cves.Vulnerability{
78-
"CVE-2014-1424": loadTestData(t, "CVE-2014-1424"),
79-
"CVE-2017-6507": loadTestData(t, "CVE-2017-6507"),
80-
"CVE-2018-1000500": loadTestData(t, "CVE-2018-1000500"),
81-
"CVE-2016-1585": loadTestData(t, "CVE-2016-1585"),
78+
"CVE-2014-1424": loadTestData(t, "CVE-2014-1424"),
79+
"CVE-2017-6507": loadTestData(t, "CVE-2017-6507"),
80+
"CVE-2016-1585": loadTestData(t, "CVE-2016-1585"),
8281
}
8382
got := generateOSVFromDebianTracker(trackerData, releaseMap, cveStuff)
8483

8584
// Define the expected OSV entries.
8685
want := map[string]*vulns.Vulnerability{
87-
"CVE-2018-1000500": {
88-
Vulnerability: osvschema.Vulnerability{
89-
ID: "DEBIAN-CVE-2018-1000500",
90-
Upstream: []string{"CVE-2018-1000500"},
91-
Modified: now,
92-
Published: now,
93-
Details: "Busybox contains a Missing SSL certificate validation vulnerability in The \"busybox wget\" applet that can result in arbitrary code execution. This attack appear to be exploitable via Simply download any file over HTTPS using \"busybox wget https://compromised-domain.com/important-file\".",
94-
Affected: []osvschema.Affected{
95-
{Package: osvschema.Package{Name: "busybox", Ecosystem: "Debian:10"}, EcosystemSpecific: map[string]any{"urgency": "end-of-life"}},
96-
{Package: osvschema.Package{Name: "busybox", Ecosystem: "Debian:11"}, EcosystemSpecific: map[string]any{"urgency": "unimportant"}},
97-
{Package: osvschema.Package{Name: "busybox", Ecosystem: "Debian:12"}, EcosystemSpecific: map[string]any{"urgency": "unimportant"}},
98-
{Package: osvschema.Package{Name: "busybox", Ecosystem: "Debian:13"}, EcosystemSpecific: map[string]any{"urgency": "unimportant"}},
99-
},
100-
References: []osvschema.Reference{{Type: "ADVISORY", URL: "https://security-tracker.debian.org/tracker/CVE-2018-1000500"}},
101-
},
102-
},
10386
"CVE-2014-1424": {
10487
Vulnerability: osvschema.Vulnerability{
10588
ID: "DEBIAN-CVE-2014-1424",
@@ -119,9 +102,6 @@ func TestGenerateOSVFromDebianTracker(t *testing.T) {
119102
Published: now,
120103
Details: "In all versions of AppArmor mount rules are accidentally widened when compiled.",
121104
Affected: []osvschema.Affected{
122-
{Package: osvschema.Package{Name: "apparmor", Ecosystem: "Debian:10"}, EcosystemSpecific: map[string]any{"urgency": "unimportant"}},
123-
{Package: osvschema.Package{Name: "apparmor", Ecosystem: "Debian:11"}, EcosystemSpecific: map[string]any{"urgency": "unimportant"}},
124-
{Package: osvschema.Package{Name: "apparmor", Ecosystem: "Debian:12"}, EcosystemSpecific: map[string]any{"urgency": "unimportant"}},
125105
{
126106
Package: osvschema.Package{Name: "apparmor", Ecosystem: "Debian:13"},
127107
Ranges: []osvschema.Range{{Type: "ECOSYSTEM", Events: []osvschema.Event{{Introduced: "0"}, {Fixed: "3.0.12-1"}}}},

vulnfeeds/test_data/debian/debian_security_tracker_mock.json

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,4 @@
11
{
2-
"busybox": {
3-
"CVE-2018-1000500": {
4-
"description": "Busybox contains a Missing SSL certificate validation vulnerability in The \"busybox wget\" applet that can result in arbitrary code execution. This attack appear to be exploitable via Simply download any file over HTTPS using \"busybox wget https://compromised-domain.com/important-file\".",
5-
"scope": "local",
6-
"releases": {
7-
"bookworm": {
8-
"status": "open",
9-
"repositories": {
10-
"bookworm": "1:1.35.0-4"
11-
},
12-
"urgency": "unimportant"
13-
},
14-
"bullseye": {
15-
"status": "open",
16-
"repositories": {
17-
"bullseye": "1:1.30.1-6"
18-
},
19-
"urgency": "unimportant"
20-
},
21-
"buster": {
22-
"status": "open",
23-
"repositories": {
24-
"buster": "1:1.30.1-4"
25-
},
26-
"urgency": "end-of-life"
27-
},
28-
"sid": {
29-
"status": "open",
30-
"repositories": {
31-
"sid": "1:1.36.1-6"
32-
},
33-
"urgency": "unimportant"
34-
},
35-
"trixie": {
36-
"status": "open",
37-
"repositories": {
38-
"trixie": "1:1.36.1-6"
39-
},
40-
"urgency": "unimportant"
41-
}
42-
}
43-
}
44-
},
452
"apparmor": {
463
"CVE-2014-1424": {
474
"description": "apparmor_parser in the apparmor package before 2.8.95~2430-0ubuntu5.1 in Ubuntu 14.04 allows attackers to bypass AppArmor policies via unspecified vectors, related to a \"miscompilation flaw.\"",

0 commit comments

Comments
 (0)