Skip to content
Merged
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
15 changes: 9 additions & 6 deletions cve_bin_tool/data_sources/nvd_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,15 @@ def format_data_api2(self, all_cve_entries):
)
cve["severity"] = re.sub(r"[\W]", "", cve["severity"])

# score should be numeric
try:
cve["score"] = float(cve["score"])
except ValueError:
self.logger.debug(f"Score for {cve['id']} is invalid: {cve['score']}")
cve["score"] = "invalid"
# score should be numeric, except when score is "unknown"
if cve["score"] != "unknown":
try:
cve["score"] = float(cve["score"])
except ValueError:
self.logger.debug(
f"Score for {cve['id']} is invalid: {cve['score']}"
)
cve["score"] = "invalid"

# CVSS_vector will be validated/normalized when cvss library is used but
# we can at least do a character filter here
Expand Down
Loading