support/scripts/cve-check: don't fail with unknown CVE
The NVD database has CVE entries that are not present but may be
referenced in other security trackers.
For instance the CVE-2024-12455 is documented in the Debian security
tracker [1]. However, the NVD page is empty [2] and this entry is not
present in the NVD database mirror.
The following command would make the script fail:
```
echo '{
"vulnerabilities": [
{
"id": "CVE-2024-12455"
}
]
}' | support/scripts/cve-check --enrich-only
```
No CVEs present in Buildroot ignored CVEs are affected. But when
enriching an SBOM with legitimate CVE not present on NVD, the script
will fail.
This patch change the behavior to just log to stderr unknown CVEs
instead of making the script fail.
[1] https://security-tracker.debian.org/tracker/CVE-2024-12455
[2] https://nvd.nist.gov/vuln/detail/CVE-2024-12455
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
[Peter: Tweak warning message]
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
committed by
Peter Korsgaard
parent
8b740cee42
commit
fa7fac0985
@@ -271,10 +271,13 @@ def enrich_vulnerabilities(nvd_path: Path, sbom):
|
||||
if vuln_id is None or not vuln_id.upper().startswith("CVE-"):
|
||||
continue
|
||||
|
||||
cve = cvecheck.CVE.read_nvd_entry(nvd_path, vuln["id"])
|
||||
cve = cvecheck.CVE.read_nvd_entry(nvd_path, vuln_id)
|
||||
|
||||
if cve is None:
|
||||
print(f"Warning: '{vuln_id}' doesn't exist in NVD database.", file=sys.stderr)
|
||||
continue
|
||||
|
||||
vulnerability = nvd_cve_to_cdx_vulnerability(cve.nvd_cve)
|
||||
|
||||
vuln_append_or_update_affects_if_exists(vulnerabilities, vulnerability)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user