summaryrefslogtreecommitdiffstats
path: root/meta/lib
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-17 06:00:32 -1000
commit76fb1012ebbdfec0a451b370b6201e89db34ea57 (patch)
tree65c0d579ef7dff17a7774d61ec11d232b9af43bc /meta/lib
parent1b7c8a3e7ebbbf47497bf10a0a50ad81870b0fb2 (diff)
downloadpoky-76fb1012ebbdfec0a451b370b6201e89db34ea57.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: 32a19dfbaac38cd4864281a1131ac65e1216318f) 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/lib')
-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 a91d691c30..ed4af18ced 100644
--- a/meta/lib/oe/cve_check.py
+++ b/meta/lib/oe/cve_check.py
@@ -114,11 +114,6 @@ def get_patched_cves(d):
114 for url in oe.patch.src_patches(d): 114 for url in oe.patch.src_patches(d):
115 patch_file = bb.fetch.decodeurl(url)[2] 115 patch_file = bb.fetch.decodeurl(url)[2]
116 116
117 # Remote compressed patches may not be unpacked, so silently ignore them
118 if not os.path.isfile(patch_file):
119 bb.warn("%s does not exist, cannot extract CVE list" % patch_file)
120 continue
121
122 # Check patch file name for CVE ID 117 # Check patch file name for CVE ID
123 fname_match = cve_file_name_match.search(patch_file) 118 fname_match = cve_file_name_match.search(patch_file)
124 if fname_match: 119 if fname_match:
@@ -126,6 +121,12 @@ def get_patched_cves(d):
126 patched_cves.add(cve) 121 patched_cves.add(cve)
127 bb.debug(2, "Found CVE %s from patch file name %s" % (cve, patch_file)) 122 bb.debug(2, "Found CVE %s from patch file name %s" % (cve, patch_file))
128 123
124 # Remote patches won't be present and compressed patches won't be
125 # unpacked, so say we're not scanning them
126 if not os.path.isfile(patch_file):
127 bb.note("%s is remote or compressed, not scanning content" % patch_file)
128 continue
129
129 with open(patch_file, "r", encoding="utf-8") as f: 130 with open(patch_file, "r", encoding="utf-8") as f:
130 try: 131 try:
131 patch_text = f.read() 132 patch_text = f.read()