Skip to content

Commit 5f3eff4

Browse files
authored
feat(vulnfeeds): write CVEs that are only Debian without package info for migration (#3985)
So that users aren't shocked by a missing CVE file when the Debian decoupling happens, keep writing out the CVEs but not the pkgInfo information for Debian
1 parent f6f9178 commit 5f3eff4

File tree

3 files changed

+10
-71
lines changed

3 files changed

+10
-71
lines changed

vulnfeeds/cmd/combine-to-osv/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const (
2424
defaultCVEListPath = "."
2525

2626
alpineEcosystem = "Alpine"
27+
debianEcosystem = "Debian"
2728
alpineSecurityTrackerURL = "https://security.alpinelinux.org/vuln"
2829
)
2930

@@ -166,6 +167,10 @@ func combineIntoOSV(loadedCves map[cves.CVEID]cves.Vulnerability, allParts map[c
166167

167168
addedAlpineURL := false
168169
for _, pkgInfo := range allParts[cveID] {
170+
// skip debian parts, but still write out the CVEs.
171+
if strings.HasPrefix(pkgInfo.Ecosystem, debianEcosystem) {
172+
continue
173+
}
169174
convertedCve.AddPkgInfo(pkgInfo)
170175
if strings.HasPrefix(pkgInfo.Ecosystem, alpineEcosystem) && !addedAlpineURL {
171176
addReference(string(cveID), alpineEcosystem, convertedCve)

vulnfeeds/cmd/combine-to-osv/main_test.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func loadTestData2(cveName string) cves.Vulnerability {
3838

3939
func TestLoadParts(t *testing.T) {
4040
allParts, _ := loadParts("../../test_data/parts")
41-
expectedPartCount := 15
41+
expectedPartCount := 14
4242
actualPartCount := len(allParts)
4343

4444
if actualPartCount != expectedPartCount {
@@ -86,15 +86,14 @@ func TestLoadParts(t *testing.T) {
8686

8787
func TestCombineIntoOSV(t *testing.T) {
8888
cveStuff := map[cves.CVEID]cves.Vulnerability{
89-
"CVE-2022-33745": loadTestData2("CVE-2022-33745"),
90-
"CVE-2022-32746": loadTestData2("CVE-2022-32746"),
91-
"CVE-2018-1000500": loadTestData2("CVE-2018-1000500"),
89+
"CVE-2022-33745": loadTestData2("CVE-2022-33745"),
90+
"CVE-2022-32746": loadTestData2("CVE-2022-32746"),
9291
}
9392
allParts, cveModifiedTime := loadParts("../../test_data/parts")
9493

9594
combinedOSV := combineIntoOSV(cveStuff, allParts, "", cveModifiedTime)
9695

97-
expectedCombined := 3
96+
expectedCombined := 2
9897
actualCombined := len(combinedOSV)
9998

10099
if actualCombined != expectedCombined {
@@ -107,13 +106,6 @@ func TestCombineIntoOSV(t *testing.T) {
107106

108107
found := false
109108
switch cve {
110-
case "CVE-2018-1000500":
111-
for _, reference := range combinedOSV[cve].References {
112-
if reference.Type == "ADVISORY" &&
113-
reference.URL == "https://security-tracker.debian.org/tracker/CVE-2018-1000500" {
114-
t.Errorf("Found unexpected Debian advisory URL for %s", cve)
115-
}
116-
}
117109
case "CVE-2022-33745":
118110
for _, reference := range combinedOSV[cve].References {
119111
if reference.Type == "ADVISORY" &&
@@ -129,7 +121,7 @@ func TestCombineIntoOSV(t *testing.T) {
129121
}
130122
}
131123
}
132-
if !found && cve != "CVE-2018-1000500" {
124+
if !found {
133125
t.Errorf("%s doesn't have all expected references", cve)
134126
}
135127
}

vulnfeeds/test_data/parts/debian/CVE-2018-1000500.debian.json

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)