cve-check: encode affected product/vendor in CVE_STATUS
RFC PATCH 1/2 cve-check: encode affected product/vendor in CVE_STATUS
CVE_STATUS contains assesment of a given CVE, but until now it didn't have include the affected vendor/product. In the case of a global system include, that CVE_STATUS was visible in all recipes.
This patch allows encoding of affected product/vendor to each CVE_STATUS assessment, also for groups. We can then filter them later and use only CVEs that correspond to the recipe.
This is going to be used in meta/conf/distro/include/cve-extra-exclusions.inc and similar places.
--- meta/classes/cve-check.bbclass | 24 ++++++++++++------------ meta/lib/oe/cve_check.py | 22 +++++++++++++--------- meta/lib/oe/spdx30_tasks.py | 11 ++++++----- 3 files changed, 31 insertions(+), 26 deletions(-)
meta/classes/cve-check.bbclass +12 -12
@@ -324,8 +324,8 @@ def check_cves(d, patched_cves): # Convert CVE_STATUS into ignored CVEs and check validity cve_ignore = [] for cve in (d.getVarFlags("CVE_STATUS") or {}): - decoded_status, _, _ = decode_cve_status(d, cve) - if decoded_status == "Ignored": + decoded_status = decode_cve_status(d, cve) + if 'mapping' in decoded_status and decoded_status['mapping'] == "Ignored": cve_ignore.append(cve) import sqlite3
@@ -507,11 +507,11 @@ def cve_write_data_text(d, patched, unpatched, ignored, cve_data): write_string += "PACKAGE VERSION: %s%s\n" % (d.getVar("EXTENDPE"), d.getVar("PV")) write_string += "CVE: %s\n" % cve write_string += "CVE STATUS: %s\n" % status - _, detail, description = decode_cve_status(d, cve) - if detail: - write_string += "CVE DETAIL: %s\n" % detail - if description: - write_string += "CVE DESCRIPTION: %s\n" % description + status_details = decode_cve_status(d, cve) + if 'detail' in status_details: + write_string += "CVE DETAIL: %s\n" % status_details['detail'] + if 'description' in status_details: + write_string += "CVE DESCRIPTION: %s\n" % status_details['description'] write_string += "CVE SUMMARY: %s\n" % cve_data[cve]["summary"] write_string += "CVSS v2 BASE SCORE: %s\n" % cve_data[cve]["scorev2"] write_string += "CVSS v3 BASE SCORE: %s\n" % cve_data[cve]["scorev3"]
@@ -637,11 +637,11 @@ def cve_write_data_json(d, patched, unpatched, ignored, cve_data, cve_status): "status" : status, "link": issue_link } - _, detail, description = decode_cve_status(d, cve) - if detail: - cve_item["detail"] = detail - if description: - cve_item["description"] = description + status_details = decode_cve_status(d, cve) + if 'detail' in status_details: + cve_item["detail"] = status_details['detail'] + if 'description' in status_details: + cve_item["description"] = status_details['description'] cve_list.append(cve_item) package_data["issue"] = cve_list
meta/lib/oe/cve_check.py +13 -9
@@ -132,8 +132,8 @@ def get_patched_cves(d): # Search for additional patched CVEs for cve in (d.getVarFlags("CVE_STATUS") or {}): - decoded_status, _, _ = decode_cve_status(d, cve) - if decoded_status == "Patched": + decoded_status = decode_cve_status(d, cve) + if 'mapping' in decoded_status and decoded_status['mapping'] == "Patched": bb.debug(2, "CVE %s is additionally patched" % cve) patched_cves.add(cve)
@@ -227,19 +227,23 @@ def convert_cve_version(version): def decode_cve_status(d, cve): """ - Convert CVE_STATUS into status, detail and description. + Convert CVE_STATUS into status, vendor, product, detail and description. """ status = d.getVarFlag("CVE_STATUS", cve) if not status: - return ("", "", "") + return {} - status_split = status.split(':', 1) - detail = status_split[0] - description = status_split[1].strip() if (len(status_split) > 1) else "" + status_split = status.split(':', 3) + status_out = {} + status_out['detail'] = status_split[0] + status_out['vendor'] = status_split[1].strip() if (len(status_split) > 3) else "*" + status_out['product'] = status_split[len(status_split)-2].strip() if (len(status_split) > 2) else "*" + status_out['description'] = status_split[len(status_split)-1].strip() if (len(status_split) > 1) else "" - status_mapping = d.getVarFlag("CVE_CHECK_STATUSMAP", detail) + status_mapping = d.getVarFlag("CVE_CHECK_STATUSMAP", status_out['detail']) if status_mapping is None: bb.warn('Invalid detail "%s" for CVE_STATUS[%s] = "%s", fallback to Unpatched' % (detail, cve, status)) status_mapping = "Unpatched" + status_out['mapping'] = status_mapping - return (status_mapping, detail, description) + return status_out
meta/lib/oe/spdx30_tasks.py +6 -5
@@ -486,21 +486,22 @@ def create_spdx(d): cve_by_status = {} if include_vex != "none": for cve in d.getVarFlags("CVE_STATUS") or {}: - status, detail, description = oe.cve_check.decode_cve_status(d, cve) + decoded_status = oe.cve_check.decode_cve_status(d, cve) # If this CVE is fixed upstream, skip it unless all CVEs are # specified. - if include_vex != "all" and detail in ( + if include_vex != "all" and 'detail' in decoded_status and \ + decoded_status['detail'] in ( "fixed-version", "cpe-stable-backport", ): bb.debug(1, "Skipping %s since it is already fixed upstream" % cve) continue - cve_by_status.setdefault(status, {})[cve] = ( + cve_by_status.setdefault(decoded_status['mapping'], {})[cve] = ( build_objset.new_cve_vuln(cve), - detail, - description, + decoded_status['detail'], + decoded_status['description'], ) cpe_ids = oe.cve_check.get_cpe_ids(d.getVar("CVE_PRODUCT"), d.getVar("CVE_VERSION"))
Signature · 1 line
2.43.0
RFC PATCH 2/2 cve-extra-inclusions: encode CPEs of affected packages
--- .../distro/include/cve-extra-exclusions.inc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
meta/conf/distro/include/cve-extra-exclusions.inc +9 -9
@@ -38,7 +38,7 @@ this to libc glob. Upstream have no plans to add BSD's GLOB_LIMIT or similar." # go https://nvd.nist.gov/vuln/detail/CVE-2020-29511 CVE_STATUS_GROUPS += "CVE_STATUS_GO" CVE_STATUS_GO = "CVE-2020-29509 CVE-2020-29511" -CVE_STATUS_GO[status] = "not-applicable-config: \ +CVE_STATUS_GO[status] = "not-applicable-config: golang:go: \ The encoding/xml package in go can potentially be used for security exploits if not used correctly \ CVE applies to a netapp product as well as flagging a general issue. We don't ship anything \ exposing this interface in an exploitable way"
@@ -50,7 +50,7 @@ CVE-2015-2656 CVE-2015-4754 CVE-2015-4764 CVE-2015-4774 CVE-2015-4775 CVE-2015-4 CVE-2015-4778 CVE-2015-4779 CVE-2015-4780 CVE-2015-4781 CVE-2015-4782 CVE-2015-4783 CVE-2015-4784 \ CVE-2015-4785 CVE-2015-4786 CVE-2015-4787 CVE-2015-4788 CVE-2015-4789 CVE-2015-4790 CVE-2016-0682 \ CVE-2016-0689 CVE-2016-0692 CVE-2016-0694 CVE-2016-3418 CVE-2020-2981" -CVE_STATUS_DB[status] = "upstream-wontfix: Since Oracle relicensed bdb, the open source community is slowly but surely \ +CVE_STATUS_DB[status] = "upstream-wontfix: oracle:berkeley_db: Since Oracle relicensed bdb, the open source community is slowly but surely \ replacing bdb with supported and open source friendly alternatives. As a result this CVE is unlikely to ever be fixed." # Kernel CVEs that are generic but can't be added to the kernel's hand-maintained cve-exclusion.inc
@@ -60,25 +60,25 @@ replacing bdb with supported and open source friendly alternatives. As a result # For OE-Core our policy is to stay as close to the kernel stable releases as we can. This should # ensure the bulk of the major kernel CVEs are fixed and we don't dive into each individual issue # as the stable maintainers are much more able to do that. -CVE_STATUS[CVE-1999-0524] = "ignored: issue is that ICMP exists, can be filewalled if required" -CVE_STATUS[CVE-2008-4609] = "ignored: describes design flaws in TCP" -CVE_STATUS[CVE-2010-4563] = "ignored: low impact, only enables detection of hosts which are sniffing network traffic" -CVE_STATUS[CVE-2011-0640] = "ignored: requires physical access and any mitigation would mean USB is impractical to use" +CVE_STATUS[CVE-1999-0524] = "ignored: linux:linux_kernel:issue is that ICMP exists, can be filewalled if required" +CVE_STATUS[CVE-2008-4609] = "ignored: linux:linux_kernel:describes design flaws in TCP" +CVE_STATUS[CVE-2010-4563] = "ignored: linux:linux_kernel:low impact, only enables detection of hosts which are sniffing network traffic" +CVE_STATUS[CVE-2011-0640] = "ignored: linux:linux_kernel:requires physical access and any mitigation would mean USB is impractical to use" # qemu:qemu-native:qemu-system-native https://nvd.nist.gov/vuln/detail/CVE-2021-20255 -CVE_STATUS[CVE-2021-20255] = "upstream-wontfix: \ +CVE_STATUS[CVE-2021-20255] = "upstream-wontfix: qemu:qemu: \ There was a proposed patch https://lists.gnu.org/archive/html/qemu-devel/2021-02/msg06098.html \ qemu maintainers say the patch is incorrect and should not be applied \ The issue is of low impact, at worst sitting in an infinite loop rather than exploitable." # qemu:qemu-native:qemu-system-native https://nvd.nist.gov/vuln/detail/CVE-2019-12067 -CVE_STATUS[CVE-2019-12067] = "upstream-wontfix: \ +CVE_STATUS[CVE-2019-12067] = "upstream-wontfix: qemu:qemu \ There was a proposed patch but rejected by upstream qemu. It is unclear if the issue can \ still be reproduced or where exactly any bug is. \ We'll pick up any fix when upstream accepts one." # nasm:nasm-native https://nvd.nist.gov/vuln/detail/CVE-2020-18974 -CVE_STATUS[CVE-2020-18974] = "upstream-wontfix: \ +CVE_STATUS[CVE-2020-18974] = "upstream-wontfix: nasm:netwide_assembler\ It is a fuzzing related buffer overflow. It is of low impact since most devices \ wouldn't expose an assembler. The upstream is inactive and there is little to be \ done about the bug, ignore from an OE perspective."
Signature · 1 line
2.43.0
Patchtest results for [RFC][PATCH 2/2] cve-extra-inclusions: encode CPEs of affected packages
Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information:
---
Testing patch /home/patchtest/share/mboxes/RFC-2-2-cve-extra-inclusions-encode-CPEs-of-affected-packages.patch
FAIL: test commit message presence: Please include a commit message on your patch explaining the change (test_mbox.TestMbox.test_commit_message_presence)
PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: pretest src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE check ignore: No modified recipes or older target branch, skipping test (test_metadata.TestMetadata.test_cve_check_ignore)
SKIP: test CVE tag format: No new CVE patches introduced (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: No new CVE patches introduced (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: No new CVE patches introduced (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)
SKIP: test target mailing list: Series merged, no reason to check other mailing lists (test_mbox.TestMbox.test_target_mailing_list)
---
Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!
Quoted 106 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Marta Rybczynska via lists.openembedded.org
Sent: Friday, August 9, 2024 8:24
To: [email protected]
Cc: Marta Rybczynska <[email protected]>
Subject: [OE-core] [RFC][PATCH 1/2] cve-check: encode affected product/vendor inCVE_STATUS
CVE_STATUScontains assesment of a given CVE, but until now it didn't have include the affected vendor/product. In the case of a global system include, thatCVE_STATUSwas visible in all recipes.This patch allows encoding of affected product/vendor to each
CVE_STATUSassessment, also for groups. We can then filter them later and use only CVEs that correspond to the recipe.This is going to be used in meta/conf/distro/include/cve-extra-exclusions.inc and similar places.
Signed-off-by Marta Rybczynska <[email protected]>--- meta/classes/cve-check.bbclass | 24 ++++++++++++------------ meta/lib/oe/cve_check.py | 22 +++++++++++++--------- meta/lib/oe/spdx30_tasks.py | 11 ++++++----- 3 files changed, 31 insertions(+), 26 deletions(-)meta/classes/cve-check.bbclass +2
-2@@ -324,8 +324,8 @@ def check_cves(d, patched_cves): # Convert CVE_STATUS into ignored CVEs and check validity cve_ignore = [] for cve in (d.getVarFlags("CVE_STATUS") or {}): - decoded_status, _, _ = decode_cve_status(d, cve) - if decoded_status == "Ignored": + decoded_status = decode_cve_status(d, cve) + if 'mapping' in decoded_status and decoded_status['mapping'] =="Ignored":
cve_ignore.append(cve)import sqlite3
meta/classes/cve-check.bbclass +0
-0@@ -507,11 +507,11 @@ def cve_write_data_text(d, patched, unpatched,ignored,
cve_data):write_string += "PACKAGE VERSION: %s%s\n" % (d.getVar("EXTENDPE"), d.getVar("PV")) write_string += "CVE: %s\n" % cve write_string += "CVE STATUS: %s\n" % statusmeta/classes/cve-check.bbclass +5
-5- _, detail, description = decode_cve_status(d, cve) - if detail: - write_string += "CVE DETAIL: %s\n" % detail - if description: - write_string += "CVE DESCRIPTION: %s\n" % description + status_details = decode_cve_status(d, cve) + if 'detail' in status_details: + write_string += "CVE DETAIL: %s\n" % status_details['detail'] + if 'description' in status_details: + write_string += "CVE DESCRIPTION: %s\n" %status_details['description']
write_string += "CVE SUMMARY: %s\n" % cve_data[cve]["summary"] write_string += "CVSS v2 BASE SCORE: %s\n" % cve_data[cve]["scorev2"] write_string += "CVSS v3 BASE SCORE: %s\n" % cve_data[cve]["scorev3"]meta/classes/cve-check.bbclass +0
-0@@ -637,11 +637,11 @@ def cve_write_data_json(d, patched, unpatched,ignored,
cve_data,cve_status):
"status" : status,
"link":issue_link
}meta/classes/cve-check.bbclass +5
-5- _, detail, description = decode_cve_status(d, cve) - if detail: - cve_item["detail"] = detail - if description: - cve_item["description"] = description + status_details = decode_cve_status(d, cve) + if 'detail' in status_details: + cve_item["detail"] = status_details['detail'] + if 'description' in status_details: + cve_item["description"] = status_details['description'] cve_list.append(cve_item) package_data["issue"] = cve_listmeta/lib/oe/cve_check.py +2
-2@@ -132,8 +132,8 @@ def get_patched_cves(d): # Search for additional patched CVEs for cve in (d.getVarFlags("CVE_STATUS") or {}): - decoded_status, _, _ = decode_cve_status(d, cve) - if decoded_status == "Patched": + decoded_status = decode_cve_status(d, cve) + if 'mapping' in decoded_status and decoded_status['mapping'] =="Patched":
bb.debug(2, "CVE %s is additionally patched" % cve)patched_cves.add(cve)meta/lib/oe/cve_check.py +1
-1@@ -227,19 +227,23 @@ def convert_cve_version(version): def decode_cve_status(d, cve): """ - Convert CVE_STATUS into status, detail and description. + Convert CVE_STATUS into status, vendor, product, detail and description.
meta/lib/oe/cve_check.py def convert_cve_version(version): · line 236
Quoted 10 lines
meta/lib/oe/cve_check.py +2
-4""" status = d.getVarFlag("CVE_STATUS", cve) if not status: - return ("", "", "") + return {} - status_split = status.split(':', 1) - detail = status_split[0] - description = status_split[1].strip() if (len(status_split) > 1) else "" + status_split = status.split(':', 3)
This effectively forbids usage of ":" in CVE_STATUS.
Since "grep -RI 'CVE_STATUS.*:.*:'" already yiealds 8 results for oe-core + meta-oe, this is not a good idea. I'd propose to keep the original split and check the first word of the second part; something like:
if status_split[1].strip().startswith('cpe:'):
extracted_cpe, status_split[1] = status_split[1].strip().split(' ', 1)
# fourth part is important here to not keep possible trailing ":" in product
extracted_cpe_split = extracted_cpe.split(':', 4)
status_out['vendor'] = "*" if len(extracted_cpe_split) == 2 or len(extracted_cpe_split[2] == 0) else extracted_cpe_split[1] status_out['product'] = extracted_cpe_split[2] if len(extracted_cpe_split) >= 3 and len(extracted_cpe_split[2] > 0) else extracted_cpe_split[1]
else:
status_out['vendor'] = "*"
status_out['product'] = "*"Quoted 55 lines
meta/lib/oe/cve_check.py +3
-0+ status_out = {} + status_out['detail'] = status_split[0] + status_out['vendor'] = status_split[1].strip() if (len(status_split) > 3) else"*"
+ status_out['product'] = status_split[len(status_split)-2].strip() if
(len(status_split)> 2) else "*"
+ status_out['description'] = status_split[len(status_split)-1].strip() if
(len(status_split)> 1) else ""meta/lib/oe/cve_check.py +1
-1- status_mapping = d.getVarFlag("CVE_CHECK_STATUSMAP", detail) + status_mapping = d.getVarFlag("CVE_CHECK_STATUSMAP",status_out['detail'])
ifstatus_mappingis None:
bb.warn('Invalid detail "%s" for CVE_STATUS[%s] = "%s", fallback to
Unpatched' % (detail, cve, status))
status_mapping= "Unpatched"meta/lib/oe/cve_check.py +2
-1+ status_out['mapping'] = status_mapping - return (status_mapping, detail, description) + return status_outmeta/lib/oe/spdx30_tasks.py +6
-5@@ -486,21 +486,22 @@ def create_spdx(d): cve_by_status = {} if include_vex != "none": for cve in d.getVarFlags("CVE_STATUS") or {}: - status, detail, description = oe.cve_check.decode_cve_status(d, cve) + decoded_status = oe.cve_check.decode_cve_status(d, cve) # If this CVE is fixed upstream, skip it unless all CVEs are # specified. - if include_vex != "all" and detail in ( + if include_vex != "all" and 'detail' in decoded_status and \ + decoded_status['detail'] in ( "fixed-version", "cpe-stable-backport", ): bb.debug(1, "Skipping %s since it is already fixed upstream" % cve) continue - cve_by_status.setdefault(status, {})[cve] = ( + cve_by_status.setdefault(decoded_status['mapping'], {})[cve] = ( build_objset.new_cve_vuln(cve), - detail, - description, + decoded_status['detail'], + decoded_status['description'], ) cpe_ids = oe.cve_check.get_cpe_ids(d.getVar("CVE_PRODUCT"),
d.getVar("CVE_VERSION"))
--
2.43.0
Quoted 144 lines · Peter
Quoted 12 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Marta Rybczynska via lists.openembedded.org
Sent: Friday, August 9, 2024 8:24
To: [email protected]
Cc: Marta Rybczynska <[email protected]>
Subject: [OE-core] [RFC][PATCH 1/2] cve-check: encode affected product/vendor inCVE_STATUSQuoted 1 line
CVE_STATUScontains assesment of a given CVE, but until now it didn'thave
Quoted 1 line
include the affected vendor/product. In the case of a global system
include,
Quoted 7 lines
that
CVE_STATUSwas visible in all recipes.This patch allows encoding of affected product/vendor to each
CVE_STATUSassessment, also for groups. We can then filter them later and use only CVEs that correspond to the recipe.This is going to be used in
meta/conf/distro/include/cve-extra-exclusions.inc
Review
Quoted 10 lines
and similar places.
Signed-off-by Marta Rybczynska <[email protected]>--- meta/classes/cve-check.bbclass | 24 ++++++++++++------------ meta/lib/oe/cve_check.py | 22 +++++++++++++--------- meta/lib/oe/spdx30_tasks.py | 11 ++++++----- 3 files changed, 31 insertions(+), 26 deletions(-)(quoted diff) +0
-0b/meta/classes/cve-check.bbclass
Quoted 17 lines
index
c946de29a4..bc35a1c53c100644meta/classes/cve-check.bbclass +2
-2@@ -324,8 +324,8 @@ def check_cves(d, patched_cves): # Convert CVE_STATUS into ignored CVEs and check validity cve_ignore = [] for cve in (d.getVarFlags("CVE_STATUS") or {}): - decoded_status, _, _ = decode_cve_status(d, cve) - if decoded_status == "Ignored": + decoded_status = decode_cve_status(d, cve) + if 'mapping' in decoded_status and decoded_status['mapping'] =="Ignored":
cve_ignore.append(cve)import sqlite3
meta/classes/cve-check.bbclass +0
-0@@ -507,11 +507,11 @@ def cve_write_data_text(d, patched, unpatched,ignored,
cve_data):Quoted 1 line
write_string += "PACKAGE VERSION: %s%s\n" %(
d.getVar("EXTENDPE"),meta/classes/cve-check.bbclass def cve_write_data_text(d, patched, unpatched, ignored, cve_data):
Quoted 11 lines
d.getVar("PV"))write_string += "CVE: %s\n" % cve write_string += "CVE STATUS: %s\n" % statusmeta/classes/cve-check.bbclass +3
-5- _, detail, description = decode_cve_status(d, cve) - if detail: - write_string += "CVE DETAIL: %s\n" % detail - if description: - write_string += "CVE DESCRIPTION: %s\n" % description + status_details = decode_cve_status(d, cve) + if 'detail' in status_details: + write_string += "CVE DETAIL: %s\n" %status_details['detail']
Quoted 5 lines
meta/classes/cve-check.bbclass +2
-0+ if 'description' in status_details: + write_string += "CVE DESCRIPTION: %s\n" %status_details['description']
write_string += "CVE SUMMARY: %s\n" % cve_data[cve]["summary"] write_string += "CVSS v2 BASE SCORE: %s\n" %cve_data[cve]["scorev2"]
Quoted 1 line
write_string += "CVSS v3 BASE SCORE: %s\n" %cve_data[cve]["scorev3"]
Quoted 35 lines
meta/classes/cve-check.bbclass +0
-0@@ -637,11 +637,11 @@ def cve_write_data_json(d, patched, unpatched,ignored,
cve_data,cve_status):
"status" : status,
"link":issue_link
}meta/classes/cve-check.bbclass +5
-5- _, detail, description = decode_cve_status(d, cve) - if detail: - cve_item["detail"] = detail - if description: - cve_item["description"] = description + status_details = decode_cve_status(d, cve) + if 'detail' in status_details: + cve_item["detail"] = status_details['detail'] + if 'description' in status_details: + cve_item["description"] = status_details['description'] cve_list.append(cve_item) package_data["issue"] = cve_listmeta/lib/oe/cve_check.py +2
-2@@ -132,8 +132,8 @@ def get_patched_cves(d): # Search for additional patched CVEs for cve in (d.getVarFlags("CVE_STATUS") or {}): - decoded_status, _, _ = decode_cve_status(d, cve) - if decoded_status == "Patched": + decoded_status = decode_cve_status(d, cve) + if 'mapping' in decoded_status and decoded_status['mapping'] =="Patched":
bb.debug(2, "CVE %s is additionally patched" % cve)patched_cves.add(cve)meta/lib/oe/cve_check.py def convert_cve_version(version): · line 230
Quoted 5 lines
meta/lib/oe/cve_check.py +1
-1@@ -227,19 +227,23 @@ def convert_cve_version(version): def decode_cve_status(d, cve): """ - Convert CVE_STATUS into status, detail and description. + Convert CVE_STATUS into status, vendor, product, detail anddescription.
meta/lib/oe/cve_check.py def convert_cve_version(version):
Quoted 9 lines
meta/lib/oe/cve_check.py +1
-4""" status = d.getVarFlag("CVE_STATUS", cve) if not status: - return ("", "", "") + return {} - status_split = status.split(':', 1) - detail = status_split[0] - description = status_split[1].strip() if (len(status_split) > 1)else ""
meta/lib/oe/cve_check.py def convert_cve_version(version): · line 236
Quoted 1 line
meta/lib/oe/cve_check.py +1
-0+ status_split = status.split(':', 3)This effectively forbids usage of ":" in
CVE_STATUS.
Since "grep -RI 'CVE_STATUS.*:.*:'" already yiealds 8 results for oe-core
+ meta-oe, this is not a good idea.
I'd propose to keep the original split and check the first word of the second part; something like:if status_split[1].strip().startswith('cpe:'):
extracted_cpe, status_split[1] = status_split[1].strip().split(' ', 1) # fourth part is important here to not keep possible trailing ":" in
product
extracted_cpe_split=extracted_cpe.split(':', 4)status_out['vendor'] = "*" iflen(extracted_cpe_split)== 2 orlen(extracted_cpe_split[2] == 0)else extracted_cpe_split[1]
status_out['product'] = extracted_cpe_split[2] iflen(extracted_cpe_split)>= 3 andlen(extracted_cpe_split[2] > 0)else extracted_cpe_split[1]
else:
Quoted 4 lines
status_out['vendor'] = "*"
status_out['product'] = "*"A valid point indeed. The "cpe:" prefix is a good idea. However, I think that splitting on ' ' isn't a very good idea either.
What about assuming that: if you give the "cpe:" part, then you always give both vendor and product. What will be valable ignored:cpe:*:*:some description
ignored:cpe:*:*:some description::
ignored:cpe:vendor:product:some description::
but not
ignored:cpe:product:some description::
Kind regards,
Marta
Quoted 42 lines
From: Marta Rybczynska <[email protected]>
Sent: Friday, August 9, 2024 12:45
To: Marko, Peter (ADV D EU SK BFS1) <[email protected]>
Cc: [email protected]; Marta Rybczynska <[email protected]>
Subject: Re: [OE-core] [RFC][PATCH 1/2] cve-check: encode affected product/vendor inCVE_STATUSQuoted 22 lines · Peter
Quoted 6 lines
-----Original Message-----
From: mailto:[email protected] <openembedded- mailto:[email protected]> On Behalf Of Marta Rybczynska via
http://lists.openembedded.org
Sent: Friday, August 9, 2024 8:24
To: mailto:[email protected]Quoted 8 lines
Cc: Marta Rybczynska <mailto:[email protected]>
Subject: [OE-core] [RFC][PATCH 1/2] cve-check: encode affected product/vendor inCVE_STATUS
<snip>
-status_split=status.split(':', 1)
- detail = status_split[0]
- description = status_split[1].strip() if (len(status_split)> 1) else "" +status_split=status.split(':', 3)This effectively forbids usage of ":" in
CVE_STATUS.
Since "grep -RI 'CVE_STATUS.*:.*:'" already yiealds 8 results for oe-core + meta-oe, this is not a good idea. I'd propose to keep the original split and check the first word of the second part; something like:if status_split[1].strip().startswith('cpe:'):
extracted_cpe, status_split[1] = status_split[1].strip().split(' ', 1)Quoted 7 lines
# fourth part is important here to not keep possible trailing ":" in product extracted_cpe_split = extracted_cpe.split(':', 4) status_out['vendor'] = "*" if len(extracted_cpe_split) == 2 or len(extracted_cpe_split[2] == 0) else extracted_cpe_split[1] status_out['product'] = extracted_cpe_split[2] if len(extracted_cpe_split) >= 3 and len(extracted_cpe_split[2] > 0) else extracted_cpe_split[1] else: status_out['vendor'] = "*" status_out['product'] = "*"A valid point indeed. The "cpe:" prefix is a good idea. However, I think that splitting on ' ' isn't a very good idea either. What about assuming that: if you give the "cpe:" part, then you always give both vendor and product. What will be valable ignored:cpe:*:*:some description
ignored:cpe:*:*:some description::
ignored:cpe:vendor:product:some description::
Quoted 5 lines
but not
ignored:cpe:product:some description::Kind regards,
Marta
Sure, why not, it's your patch.
I just wanted to point out a problem.
Kind Regards,
Peter