diff options
author | Ross Burton <ross.burton@arm.com> | 2023-11-03 13:28:11 +0000 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2023-11-11 08:23:01 -1000 |
commit | 61dee9640349716365010ddc962ae4f83f31b11f (patch) | |
tree | aac937c5fa99335cdc69b301c42f9e4452c87dcc | |
parent | ea56fc0611c205980e7aba441b5b82a0fa4e0e50 (diff) | |
download | poky-61dee9640349716365010ddc962ae4f83f31b11f.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: 4f21354c7204c3404326ddc243d02056387472d3)
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>
-rw-r--r-- | meta/lib/oe/cve_check.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/meta/lib/oe/cve_check.py b/meta/lib/oe/cve_check.py index b4c9f6ffe3..8acd2879bf 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() |