summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2023-11-03 13:28:11 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-11-03 16:58:40 +0000
commit7ffa4d4044b9288eefa44fcc80c246a4def2435b (patch)
tree025071aad6806578d65f3c2a346484baed6f7c2e /meta/lib/oe
parente575f59b82eae78fb1ac8df7198eaa4a7a963259 (diff)
downloadpoky-7ffa4d4044b9288eefa44fcc80c246a4def2435b.tar.gz
cve-check: don't warn if a patch is remote
We don't make do_cve_check depend on do_unpack because that would be a waste of time 99% of the time. The compromise here is that we can't scan remote patches for issues, but this isn't a problem so downgrade the warning to a note. Also move the check for CVEs in the filename before the local file check so that even with remote patches, we still check for CVE references in the name. (From OE-Core rev: 0251cad677579f5b4dcc25fa2f8552c6040ac2cf) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r--meta/lib/oe/cve_check.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/meta/lib/oe/cve_check.py b/meta/lib/oe/cve_check.py
index c0ab22d25e..3fa77bf9a7 100644
--- a/meta/lib/oe/cve_check.py
+++ b/meta/lib/oe/cve_check.py
@@ -95,11 +95,6 @@ def get_patched_cves(d):
95 for url in oe.patch.src_patches(d): 95 for url in oe.patch.src_patches(d):
96 patch_file = bb.fetch.decodeurl(url)[2] 96 patch_file = bb.fetch.decodeurl(url)[2]
97 97
98 # Remote compressed patches may not be unpacked, so silently ignore them
99 if not os.path.isfile(patch_file):
100 bb.warn("%s does not exist, cannot extract CVE list" % patch_file)
101 continue
102
103 # Check patch file name for CVE ID 98 # Check patch file name for CVE ID
104 fname_match = cve_file_name_match.search(patch_file) 99 fname_match = cve_file_name_match.search(patch_file)
105 if fname_match: 100 if fname_match:
@@ -107,6 +102,12 @@ def get_patched_cves(d):
107 patched_cves.add(cve) 102 patched_cves.add(cve)
108 bb.debug(2, "Found CVE %s from patch file name %s" % (cve, patch_file)) 103 bb.debug(2, "Found CVE %s from patch file name %s" % (cve, patch_file))
109 104
105 # Remote patches won't be present and compressed patches won't be
106 # unpacked, so say we're not scanning them
107 if not os.path.isfile(patch_file):
108 bb.note("%s is remote or compressed, not scanning content" % patch_file)
109 continue
110
110 with open(patch_file, "r", encoding="utf-8") as f: 111 with open(patch_file, "r", encoding="utf-8") as f:
111 try: 112 try:
112 patch_text = f.read() 113 patch_text = f.read()