Skip to content

Commit 37be218

Browse files
committed
Revert "fix tests"
This reverts commit 315a261.
1 parent af76f90 commit 37be218

File tree

2 files changed

+32
-28
lines changed

2 files changed

+32
-28
lines changed

vulnfeeds/cmd/debian/main_test.go

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import (
55
"fmt"
66
"os"
77
"sort"
8-
"strings"
9-
"sync"
108
"testing"
9+
"time"
1110

1211
"github.com/google/go-cmp/cmp"
1312
"github.com/google/osv/vulnfeeds/cves"
@@ -59,6 +58,9 @@ func loadTestData(t *testing.T, cveName string) cves.Vulnerability {
5958
}
6059

6160
func TestGenerateOSVFromDebianTracker(t *testing.T) {
61+
// Mock the time
62+
now := time.Date(2024, 7, 1, 0, 0, 0, 0, time.UTC)
63+
6264
var trackerData DebianSecurityTrackerData
6365
if err := json.Unmarshal(mustRead(t, "../../test_data/debian/debian_security_tracker_mock.json"), &trackerData); err != nil {
6466
t.Fatalf("Failed to unmarshal test data: %v", err)
@@ -78,30 +80,17 @@ func TestGenerateOSVFromDebianTracker(t *testing.T) {
7880
"CVE-2018-1000500": loadTestData(t, "CVE-2018-1000500"),
7981
"CVE-2016-1585": loadTestData(t, "CVE-2016-1585"),
8082
}
81-
82-
vulnChan := make(chan *vulns.Vulnerability)
83-
got := make(map[string]*vulns.Vulnerability)
84-
var wg sync.WaitGroup
85-
wg.Add(1)
86-
go func() {
87-
defer wg.Done()
88-
for v := range vulnChan {
89-
cveID := strings.TrimPrefix(v.ID, "DEBIAN-")
90-
got[cveID] = v
91-
}
92-
}()
93-
94-
generateOSVFromDebianTracker(trackerData, releaseMap, cveStuff, vulnChan)
95-
close(vulnChan)
96-
wg.Wait()
83+
got := generateOSVFromDebianTracker(trackerData, releaseMap, cveStuff)
9784

9885
// Define the expected OSV entries.
9986
want := map[string]*vulns.Vulnerability{
10087
"CVE-2018-1000500": {
10188
Vulnerability: osvschema.Vulnerability{
102-
ID: "DEBIAN-CVE-2018-1000500",
103-
Upstream: []string{"CVE-2018-1000500"},
104-
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\".",
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\".",
10594
Affected: []osvschema.Affected{
10695
{Package: osvschema.Package{Name: "busybox", Ecosystem: "Debian:10"}, EcosystemSpecific: map[string]any{"urgency": "end-of-life"}},
10796
{Package: osvschema.Package{Name: "busybox", Ecosystem: "Debian:11"}, EcosystemSpecific: map[string]any{"urgency": "unimportant"}},
@@ -111,11 +100,24 @@ func TestGenerateOSVFromDebianTracker(t *testing.T) {
111100
References: []osvschema.Reference{{Type: "ADVISORY", URL: "https://security-tracker.debian.org/tracker/CVE-2018-1000500"}},
112101
},
113102
},
103+
"CVE-2014-1424": {
104+
Vulnerability: osvschema.Vulnerability{
105+
ID: "DEBIAN-CVE-2014-1424",
106+
Upstream: []string{"CVE-2014-1424"},
107+
Modified: now,
108+
Published: now,
109+
Details: "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.\"",
110+
Affected: nil, // Empty because all are resolved at version "0"
111+
References: []osvschema.Reference{{Type: "ADVISORY", URL: "https://security-tracker.debian.org/tracker/CVE-2014-1424"}},
112+
},
113+
},
114114
"CVE-2016-1585": {
115115
Vulnerability: osvschema.Vulnerability{
116-
ID: "DEBIAN-CVE-2016-1585",
117-
Upstream: []string{"CVE-2016-1585"},
118-
Details: "In all versions of AppArmor mount rules are accidentally widened when compiled.",
116+
ID: "DEBIAN-CVE-2016-1585",
117+
Upstream: []string{"CVE-2016-1585"},
118+
Modified: now,
119+
Published: now,
120+
Details: "In all versions of AppArmor mount rules are accidentally widened when compiled.",
119121
Affected: []osvschema.Affected{
120122
{Package: osvschema.Package{Name: "apparmor", Ecosystem: "Debian:10"}, EcosystemSpecific: map[string]any{"urgency": "unimportant"}},
121123
{Package: osvschema.Package{Name: "apparmor", Ecosystem: "Debian:11"}, EcosystemSpecific: map[string]any{"urgency": "unimportant"}},
@@ -131,9 +133,11 @@ func TestGenerateOSVFromDebianTracker(t *testing.T) {
131133
},
132134
"CVE-2017-6507": {
133135
Vulnerability: osvschema.Vulnerability{
134-
ID: "DEBIAN-CVE-2017-6507",
135-
Upstream: []string{"CVE-2017-6507"},
136-
Details: "An issue was discovered in AppArmor before 2.12. Incorrect handling of unknown AppArmor profiles in AppArmor init scripts, upstart jobs, and/or systemd unit files allows an attacker to possibly have increased attack surfaces of processes that were intended to be confined by AppArmor. This is due to the common logic to handle 'restart' operations removing AppArmor profiles that aren't found in the typical filesystem locations, such as /etc/apparmor.d/. Userspace projects that manage their own AppArmor profiles in atypical directories, such as what's done by LXD and Docker, are affected by this flaw in the AppArmor init script logic.",
136+
ID: "DEBIAN-CVE-2017-6507",
137+
Upstream: []string{"CVE-2017-6507"},
138+
Modified: now,
139+
Published: now,
140+
Details: "An issue was discovered in AppArmor before 2.12. Incorrect handling of unknown AppArmor profiles in AppArmor init scripts, upstart jobs, and/or systemd unit files allows an attacker to possibly have increased attack surfaces of processes that were intended to be confined by AppArmor. This is due to the common logic to handle 'restart' operations removing AppArmor profiles that aren't found in the typical filesystem locations, such as /etc/apparmor.d/. Userspace projects that manage their own AppArmor profiles in atypical directories, such as what's done by LXD and Docker, are affected by this flaw in the AppArmor init script logic.",
137141
Affected: []osvschema.Affected{
138142
{
139143
Package: osvschema.Package{Name: "apparmor", Ecosystem: "Debian:10"},

vulnfeeds/cmd/debian/run_debian_convert.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ echo "Begin syncing NVD data from GCS bucket ${INPUT_BUCKET}"
2222
gcloud --no-user-output-enabled storage -q cp "gs://${INPUT_BUCKET}/nvd/*-????.json" "${CVE_OUTPUT}"
2323
echo "Successfully synced from GCS bucket"
2424

25-
./debian -output_bucket "$OUTPUT_BUCKET" -output_path "$OSV_OUTPUT_PATH"
25+
./debian-osv -output_bucket "$OUTPUT_BUCKET" -output_path "$OSV_OUTPUT_PATH"
2626
echo "Successfully converted and uploaded to cloud"

0 commit comments

Comments
 (0)