improve_kernel_cve_report: do not override backported-patch
PATCH 1/2 improve_kernel_cve_report: do not override backported-patch
From: Daniel Turull <[email protected]>
If the user has a CVE_STATUS for their own backported patch, the backport takes priority over upstream vulnerable versions.
Signed-off-by Daniel Turull <[email protected]>
--- scripts/contrib/improve_kernel_cve_report.py | 4 ++++ 1 file changed, 4 insertions(+)
scripts/contrib/improve_kernel_cve_report.py +4 -0
@@ -340,6 +340,10 @@ def cve_update(cve_data, cve, entry): if cve_data[cve]['status'] == entry['status']: return if entry['status'] == "Unpatched" and cve_data[cve]['status'] == "Patched": + # Backported-patch (e.g. vendor kernel repo with cherry-picked CVE patch) + # has priority over unpatch from CNA + if cve_data[cve]['detail'] == "backported-patch": + return logging.warning("CVE entry %s update from Patched to Unpatched from the scan result", cve) cve_data[cve] = copy_data(cve_data[cve], entry) return
PATCH 2/2 improve_kernel_cve_report: do not use custom version
From: Daniel Turull <[email protected]>
When using the version specified in cve-summary.json, we need to remove the suffix containing the custom version to match the versions from the CVEs.
This patch truncates the version from cve-summary.json to use only the base version of the kernel.
This is only applicable for kernels where the user has added their own version.
Signed-off-by Daniel Turull <[email protected]>
--- scripts/contrib/improve_kernel_cve_report.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/contrib/improve_kernel_cve_report.py +4 -2
@@ -445,10 +445,12 @@ def main(): is_kernel=True if not is_kernel: continue - + # We remove custom versions after - + upstream_version = Version(pkg["version"].split("-")[0]) + logging.info("Checking kernel %s", upstream_version) kernel_cves = get_kernel_cves(args.datadir, compiled_files, - Version(pkg["version"])) + upstream_version) logging.info("Total kernel cves from kernel CNA: %s", len(kernel_cves)) cves = {issue["id"]: issue for issue in pkg["issue"]} logging.info("Total kernel before processing cves: %s", len(cves))