summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2023-11-03 13:28:11 +0000
committerSteve Sakoman <steve@sakoman.com>2023-11-14 06:49:11 -1000
commit2e3c89e2559579b5f451c6ca08b2f2951e3af23a (patch)
tree07acbe7a9914c39ee6956e5b51dbf77eea25d7f3 /meta
parent9200c6b310c700343e2a2453bf974c834928365e (diff)
downloadpoky-2e3c89e2559579b5f451c6ca08b2f2951e3af23a.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: b4e5e02ab5dcc6b32810aa88c371799777dd8821) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 0251cad677579f5b4dcc25fa2f8552c6040ac2cf) Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta')
-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 2efc4290af..65b1358ffc 100644
--- a/meta/lib/oe/cve_check.py
+++ b/meta/lib/oe/cve_check.py
@@ -89,11 +89,6 @@ def get_patched_cves(d):
89 for url in oe.patch.src_patches(d): 89 for url in oe.patch.src_patches(d):
90 patch_file = bb.fetch.decodeurl(url)[2] 90 patch_file = bb.fetch.decodeurl(url)[2]
91 91
92 # Remote compressed patches may not be unpacked, so silently ignore them
93 if not os.path.isfile(patch_file):
94 bb.warn("%s does not exist, cannot extract CVE list" % patch_file)
95 continue
96
97 # Check patch file name for CVE ID 92 # Check patch file name for CVE ID
98 fname_match = cve_file_name_match.search(patch_file) 93 fname_match = cve_file_name_match.search(patch_file)
99 if fname_match: 94 if fname_match:
@@ -101,6 +96,12 @@ def get_patched_cves(d):
101 patched_cves.add(cve) 96 patched_cves.add(cve)
102 bb.debug(2, "Found CVE %s from patch file name %s" % (cve, patch_file)) 97 bb.debug(2, "Found CVE %s from patch file name %s" % (cve, patch_file))
103 98
99 # Remote patches won't be present and compressed patches won't be
100 # unpacked, so say we're not scanning them
101 if not os.path.isfile(patch_file):
102 bb.note("%s is remote or compressed, not scanning content" % patch_file)
103 continue
104
104 with open(patch_file, "r", encoding="utf-8") as f: 105 with open(patch_file, "r", encoding="utf-8") as f:
105 try: 106 try:
106 patch_text = f.read() 107 patch_text = f.read()