Skip to content

Commit bcd6685

Browse files
authored
fix: check if there are no metrics on NVD before attempting to add to Alpine/Debian records (#4044)
1 parent 22fa55d commit bcd6685

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

vulnfeeds/cmd/alpine/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func main() {
3636
logger.InitGlobalLogger()
3737

3838
alpineOutputPath := flag.String(
39-
"alpineOutput",
39+
"output_path",
4040
alpineOutputPathDefault,
4141
"path to output general alpine affected package information")
4242
outputBucketName := flag.String("output_bucket", outputBucketDefault, "The GCS bucket to write to.")
@@ -220,7 +220,10 @@ func generateAlpineOSV(allAlpineSecDb map[string][]VersionAndPkg, allCVEs map[cv
220220
logger.Warn(fmt.Sprintf("Skipping %s as no affected versions found.", v.ID), slog.String("cveID", cveID))
221221
continue
222222
}
223-
v.AddSeverity(cve.CVE.Metrics)
223+
if cve.CVE.Metrics != nil {
224+
v.AddSeverity(cve.CVE.Metrics)
225+
}
226+
224227
osvVulnerabilities = append(osvVulnerabilities, v)
225228
}
226229

vulnfeeds/cmd/debian/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ func generateOSVFromDebianTracker(debianData DebianSecurityTrackerData, debianRe
143143
},
144144
},
145145
}
146-
v.AddSeverity(currentNVDCVE.CVE.Metrics)
146+
if currentNVDCVE.CVE.Metrics != nil {
147+
v.AddSeverity(currentNVDCVE.CVE.Metrics)
148+
}
149+
147150
osvCves[cveID] = v
148151
}
149152

0 commit comments

Comments
 (0)