mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
cve_check: cleanup logging
Primarily list the number of patches found, useful when debugging. Also clean up some bad escaping that caused warnings and use re.IGNORECASE instead of manually doing case-insenstive rang matches. (From OE-Core rev: 10acc75b7f3387b968bacd51aade6a8dc11a463f) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
ab375ea3fe
commit
bfaea5f7ec
@@ -79,20 +79,19 @@ def get_patched_cves(d):
|
||||
import re
|
||||
import oe.patch
|
||||
|
||||
pn = d.getVar("PN")
|
||||
cve_match = re.compile("CVE:( CVE\-\d{4}\-\d+)+")
|
||||
cve_match = re.compile(r"CVE:( CVE-\d{4}-\d+)+")
|
||||
|
||||
# Matches the last "CVE-YYYY-ID" in the file name, also if written
|
||||
# in lowercase. Possible to have multiple CVE IDs in a single
|
||||
# file name, but only the last one will be detected from the file name.
|
||||
# However, patch files contents addressing multiple CVE IDs are supported
|
||||
# (cve_match regular expression)
|
||||
|
||||
cve_file_name_match = re.compile(".*([Cc][Vv][Ee]\-\d{4}\-\d+)")
|
||||
cve_file_name_match = re.compile(r".*(CVE-\d{4}-\d+)", re.IGNORECASE)
|
||||
|
||||
patched_cves = set()
|
||||
bb.debug(2, "Looking for patches that solves CVEs for %s" % pn)
|
||||
for url in oe.patch.src_patches(d):
|
||||
patches = oe.patch.src_patches(d)
|
||||
bb.debug(2, "Scanning %d patches for CVEs" % len(patches))
|
||||
for url in patches:
|
||||
patch_file = bb.fetch.decodeurl(url)[2]
|
||||
|
||||
# Check patch file name for CVE ID
|
||||
@@ -100,7 +99,7 @@ def get_patched_cves(d):
|
||||
if fname_match:
|
||||
cve = fname_match.group(1).upper()
|
||||
patched_cves.add(cve)
|
||||
bb.debug(2, "Found CVE %s from patch file name %s" % (cve, patch_file))
|
||||
bb.debug(2, "Found %s from patch file name %s" % (cve, patch_file))
|
||||
|
||||
# Remote patches won't be present and compressed patches won't be
|
||||
# unpacked, so say we're not scanning them
|
||||
|
||||
Reference in New Issue
Block a user