From patchwork Tue Dec 1 10:02:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "P. Tatrai" X-Patchwork-Id: 106771 Received: from mta-65-227.siemens.flowmailer.net (mta-65-227.siemens.flowmailer.net [185.136.65.227]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.7763.1796119356300472304 for ; Tue, 01 Dec 2026 02:02:37 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.tatrai.ext@siemens.com header.s=fm1 header.b=YIMOkaHD; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.227, mailfrom: fm-1328017-20261201100232e20871a4a000020708-cxybib@rts-flowmailer.siemens.com) Received: by mta-65-227.siemens.flowmailer.net with ESMTPSA id 20261201100232e20871a4a000020708 for ; Tue, 01 Dec 2026 11:02:33 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.tatrai.ext@siemens.com; h=from:from:sender:to:to:cc:subject:subject:content-type:content-transfer-encoding:content-transfer-encoding:References:In-Reply-To:Date:Message-ID:MIME-Version; bh=2mysdFHUSB5HWoWC9L4gfZjcXVWZ28gDvQpcsfQhglM=; b=YIMOkaHD+xCYoYEwiKXdcLmAE2+4eSaPynXU6OPNabQE3l57CdoyJn3H0vxxGj7fmFEq8S lp7TnU0eXk9OV85huTWoGdD2x+Ijgky/daVrGaDq3qBbWoQpNVtwcQu8F5Cwqy3kc98YwjHJ iQtVWHZt8RDYTk0fvDkkI2cLQYeY9haiXg8eoZO8PqdkCN1rJ/WNWR8dzZffs2P6lexkMV4j UD3Z8v2mV3QUMIA2O3BWj142YClztmyYuz4foZhRi1pQIvWfX4vsODKElIgZWfSZymMqK0IG Zoh7YajpQG/uUS6RLz0rziHNLwcWHbmUPkcE6mV6ysKv8PdPZJPlYtuw==; From: "P. Tatrai" To: openembedded-core@lists.openembedded.org Subject: [scarthgap][PATCH v2 1/8] cve-check: decode product and vendor in CVE_STATUS Date: Tue, 1 Dec 2026 11:02:24 +0100 Message-Id: <20261201100231.3119168-2-peter.tatrai.ext@siemens.com> In-Reply-To: <20261201100231.3119168-1-peter.tatrai.ext@siemens.com> References: <20261201100231.3119168-1-peter.tatrai.ext@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1328017:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 01 Dec 2026 10:02:41 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251703 From: Peter Tatrai CVE_STATUS entries from global includes such as cve-extra-exclusions.inc are visible to every recipe. Master added an optional "detail: cpe:vendor:product: description" syntax so that such entries can name the product they apply to. This is a partial backport of master commit abca80a716e92fc18d3085aba1a15f4bac72379c. The parser is picked unchanged, but under the name decode_cve_status_scoped(), and decode_cve_status() keeps returning the (status, detail, description) tuple it returns on scarthgap. Changing its return type, as master did, would break existing callers in other layers on a stable branch. The master hunks in cve-check.bbclass and spdx30_tasks.py only convert callers to the new return type and are therefore not needed. The parser as merged in master truncates descriptions containing ":" and references an undefined variable in its warnings. The following patches backport the master fixes for that. AI-Generated: GitHub Copilot CLI, Claude Opus 5.5 Signed-off-by: Peter Tatrai --- meta/lib/oe/cve_check.py | 46 +++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/meta/lib/oe/cve_check.py b/meta/lib/oe/cve_check.py index 7c09b78..c915ab8 100644 --- a/meta/lib/oe/cve_check.py +++ b/meta/lib/oe/cve_check.py @@ -225,24 +225,54 @@ def convert_cve_version(version): return version + update -def decode_cve_status(d, cve): +def decode_cve_status_scoped(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(':', 5) + status_out = {} + status_out["detail"] = status_split[0] + product = "*" + vendor = "*" + description = "" + if len(status_split) >= 4 and status_split[1].strip() == "cpe": + # Both vendor and product are mandatory if cpe: present, the syntax is then: + # detail: cpe:vendor:product:description + vendor = status_split[2].strip() + product = status_split[3].strip() + description = status_split[4].strip() + elif len(status_split) >= 2 and status_split[1].strip() == "cpe": + # Malformed CPE + bb.warn('Invalid CPE information for CVE_STATUS[%s] = "%s", not setting CPE' % (detail, cve, status)) + else: + # Other case: no CPE, the syntax is then: + # detail: description + description = status_split[len(status_split)-1].strip() if (len(status_split) > 1) else "" - status_split = status.split(':', 1) - detail = status_split[0] - description = status_split[1].strip() if (len(status_split) > 1) else "" + status_out["vendor"] = vendor + status_out["product"] = product + status_out["description"] = description - 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_out - return (status_mapping, detail, description) +def decode_cve_status(d, cve): + """ + Convert CVE_STATUS into status, detail and description. + """ + status = decode_cve_status_scoped(d, cve) + if not status: + return ("", "", "") + return (status["mapping"], status["detail"], status["description"]) def extend_cve_status(d): # do this only once in case multiple classes use this