diff options
author | Marta Rybczynska <rybczynska@gmail.com> | 2024-08-14 07:30:35 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-08-20 14:12:40 +0100 |
commit | bf34db143956294d64998beb3a83f46c1e39d9d9 (patch) | |
tree | ca71d629cab42168c69584c132ea362bb790c4db /meta/classes | |
parent | 326b4303eaf198b7a463d3e6e5037565c22e4823 (diff) | |
download | poky-bf34db143956294d64998beb3a83f46c1e39d9d9.tar.gz |
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.
(From OE-Core rev: abca80a716e92fc18d3085aba1a15f4bac72379c)
Signed-off-by: Marta Rybczynska <marta.rybczynska@syslinbit.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/cve-check.bbclass | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/meta/classes/cve-check.bbclass b/meta/classes/cve-check.bbclass index c946de29a4..bc35a1c53c 100644 --- a/meta/classes/cve-check.bbclass +++ b/meta/classes/cve-check.bbclass | |||
@@ -324,8 +324,8 @@ def check_cves(d, patched_cves): | |||
324 | # Convert CVE_STATUS into ignored CVEs and check validity | 324 | # Convert CVE_STATUS into ignored CVEs and check validity |
325 | cve_ignore = [] | 325 | cve_ignore = [] |
326 | for cve in (d.getVarFlags("CVE_STATUS") or {}): | 326 | for cve in (d.getVarFlags("CVE_STATUS") or {}): |
327 | decoded_status, _, _ = decode_cve_status(d, cve) | 327 | decoded_status = decode_cve_status(d, cve) |
328 | if decoded_status == "Ignored": | 328 | if 'mapping' in decoded_status and decoded_status['mapping'] == "Ignored": |
329 | cve_ignore.append(cve) | 329 | cve_ignore.append(cve) |
330 | 330 | ||
331 | import sqlite3 | 331 | import sqlite3 |
@@ -507,11 +507,11 @@ def cve_write_data_text(d, patched, unpatched, ignored, cve_data): | |||
507 | write_string += "PACKAGE VERSION: %s%s\n" % (d.getVar("EXTENDPE"), d.getVar("PV")) | 507 | write_string += "PACKAGE VERSION: %s%s\n" % (d.getVar("EXTENDPE"), d.getVar("PV")) |
508 | write_string += "CVE: %s\n" % cve | 508 | write_string += "CVE: %s\n" % cve |
509 | write_string += "CVE STATUS: %s\n" % status | 509 | write_string += "CVE STATUS: %s\n" % status |
510 | _, detail, description = decode_cve_status(d, cve) | 510 | status_details = decode_cve_status(d, cve) |
511 | if detail: | 511 | if 'detail' in status_details: |
512 | write_string += "CVE DETAIL: %s\n" % detail | 512 | write_string += "CVE DETAIL: %s\n" % status_details['detail'] |
513 | if description: | 513 | if 'description' in status_details: |
514 | write_string += "CVE DESCRIPTION: %s\n" % description | 514 | write_string += "CVE DESCRIPTION: %s\n" % status_details['description'] |
515 | write_string += "CVE SUMMARY: %s\n" % cve_data[cve]["summary"] | 515 | write_string += "CVE SUMMARY: %s\n" % cve_data[cve]["summary"] |
516 | write_string += "CVSS v2 BASE SCORE: %s\n" % cve_data[cve]["scorev2"] | 516 | write_string += "CVSS v2 BASE SCORE: %s\n" % cve_data[cve]["scorev2"] |
517 | write_string += "CVSS v3 BASE SCORE: %s\n" % cve_data[cve]["scorev3"] | 517 | 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): | |||
637 | "status" : status, | 637 | "status" : status, |
638 | "link": issue_link | 638 | "link": issue_link |
639 | } | 639 | } |
640 | _, detail, description = decode_cve_status(d, cve) | 640 | status_details = decode_cve_status(d, cve) |
641 | if detail: | 641 | if 'detail' in status_details: |
642 | cve_item["detail"] = detail | 642 | cve_item["detail"] = status_details['detail'] |
643 | if description: | 643 | if 'description' in status_details: |
644 | cve_item["description"] = description | 644 | cve_item["description"] = status_details['description'] |
645 | cve_list.append(cve_item) | 645 | cve_list.append(cve_item) |
646 | 646 | ||
647 | package_data["issue"] = cve_list | 647 | package_data["issue"] = cve_list |