Skip to content

Commit e3ac5d1

Browse files
committed
spdx: Update spdx to include 'Ignored' CVEs
Signed-off-by: Can Wong <can.wong@emerson.com>
1 parent 9b431e3 commit e3ac5d1

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

meta/classes/create-spdx-2.2.bbclass

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,16 @@ python do_create_spdx() {
605605
if patched_cves:
606606
recipe.sourceInfo = "CVEs fixed: " + patched_cves
607607

608+
ignored_cves = oe.cve_check.get_ignored_cves(d)
609+
ignored_cves = list(ignored_cves)
610+
ignored_cves = ' '.join(ignored_cves)
611+
if ignored_cves:
612+
if patched_cves:
613+
recipe.sourceInfo += "; "
614+
else:
615+
recipe.sourceInfo = ""
616+
recipe.sourceInfo += "CVEs ignored: " + ignored_cves
617+
608618
cpe_ids = oe.cve_check.get_cpe_ids(d.getVar("CVE_PRODUCT"), d.getVar("CVE_VERSION"))
609619
if cpe_ids:
610620
for cpe_id in cpe_ids:

meta/lib/oe/cve_check.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,19 @@ def get_patched_cves(d):
140140
return patched_cves
141141

142142

143+
def get_ignored_cves(d):
144+
"""
145+
Get CVEs that are marked as ignore using the "CVE_STATUS" flag.
146+
"""
147+
ignored_cves = set()
148+
for cve in (d.getVarFlags("CVE_STATUS") or {}):
149+
decoded_status, _, _ = decode_cve_status(d, cve)
150+
if decoded_status == "Ignored":
151+
bb.debug(2, "CVE %s is ignored" % cve)
152+
ignored_cves.add(cve)
153+
return ignored_cves
154+
155+
143156
def get_cpe_ids(cve_product, version):
144157
"""
145158
Get list of CPE identifiers for the given product and version

0 commit comments

Comments
 (0)