From patchwork Tue Dec 1 10:02:25 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "P. Tatrai" X-Patchwork-Id: 106774 Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.7722.1796119356300784000 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=Y2o0XW9y; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.226, mailfrom: fm-1328017-202612011002328dad9c4aba0002072e-muvkno@rts-flowmailer.siemens.com) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 202612011002328dad9c4aba0002072e 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-type:content-transfer-encoding:content-transfer-encoding:References:In-Reply-To:Date:Message-ID:MIME-Version; bh=MfUGGnRDSrfvqeM0D8zfYkN84vjpkDoTQZYpxP1w+YA=; b=Y2o0XW9yqQIIjN1aapGVQxZD2DABBQp74l73b+THyB0wABz/HpjYAVjCfAk/q3SfVQ6b70 J+uUgowT9r0ztdcRN31Ei+GEfbSCe9bQ6qB5HZYYasTozDmBq/JazTV9WGeBmBP5YAYBpKKI 5gsVn+IREJyt8u/w3gvAZX+e79Wuq+WrNSpb6Ss7S8l+wBv5SBxuij8wAPKbRakWo0Bfg6MQ GpGKPedFlKLuhRkpMWA+V/1VRAunEZgYURkvUv4+tq/DGdPgQvwk6e3yPJEE6m7DoMNHZkFr 7ET16V8dnYAcQsCZajlfohWx6wKvxPvfe0NODvRxudJFK4cTE0Jep8nA==; From: "P. Tatrai" To: openembedded-core@lists.openembedded.org Subject: [scarthgap][PATCH v2 2/8] cve-check: only apply CVE_STATUS to matching products Date: Tue, 1 Dec 2026 11:02:25 +0100 Message-Id: <20261201100231.3119168-3-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:50 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251706 From: Peter Tatrai Without product filtering, global CVE_STATUS entries are reported for every recipe. The scarthgap SPDX 3.0 backport [1] and the follow-up that exports all CVE_STATUS entries [2] also put those entries into the SPDX/VEX output of unrelated recipes. This is a partial backport of master commit 452e605b55ad61c08f4af7089a5a9c576ca28f7d. Only has_cve_product_match() is picked unchanged. The rest of that commit refactors cve-check.bbclass to pass per-CVE annotations around and changes get_patched_cves() to return a dict, which is not applicable to scarthgap. Master applies the match in its callers. Here it is applied once in decode_cve_status(), so all existing tuple users get it, including get_patched_cves(), cve-check, VEX and SPDX. Unlike master, entries without a cpe: scope still apply when CVE_PRODUCT is empty, so their existing behaviour does not change. An empty result from decode_cve_status() now usually means the entry is scoped to another product, which is not a problem. Drop the per-CVE "Skipping ... missing or unknown CVE status" warnings that exist only in scarthgap's VEX and SPDX code; they would fire for every scoped global entry in every recipe. Invalid status details and malformed cpe: scopes are still warned about by the parser. [1] https://git.openembedded.org/openembedded-core/commit/?id=9c9b9545049a [2] https://git.openembedded.org/openembedded-core/commit/?id=9a204670b1c0 AI-Generated: GitHub Copilot CLI, Claude Opus 5.5 Signed-off-by: Peter Tatrai --- meta/classes/vex.bbclass | 1 - meta/lib/oe/cve_check.py | 24 +++++++++++++++++++++++- meta/lib/oe/spdx30_tasks.py | 1 - 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/meta/classes/vex.bbclass b/meta/classes/vex.bbclass index 97213ea..3c44dbb 100644 --- a/meta/classes/vex.bbclass +++ b/meta/classes/vex.bbclass @@ -141,7 +141,6 @@ python do_generate_vex () { for cve_id in (d.getVarFlags("CVE_STATUS") or {}): mapping, detail, description = decode_cve_status(d, cve_id) if not mapping or not detail: - bb.warn(f"Skipping {cve_id} — missing or unknown CVE status") continue cve_data[cve_id] = { "abbrev-status": mapping, diff --git a/meta/lib/oe/cve_check.py b/meta/lib/oe/cve_check.py index c915ab8..6689d4a 100644 --- a/meta/lib/oe/cve_check.py +++ b/meta/lib/oe/cve_check.py @@ -267,13 +267,35 @@ def decode_cve_status_scoped(d, cve): def decode_cve_status(d, cve): """ - Convert CVE_STATUS into status, detail and description. + Convert CVE_STATUS into status, detail and description, ignoring + entries scoped to a product not in CVE_PRODUCT. """ status = decode_cve_status_scoped(d, cve) if not status: return ("", "", "") + # Unscoped entries keep applying when CVE_PRODUCT is empty. + unscoped = status["vendor"] == status["product"] == "*" + if not unscoped and not has_cve_product_match(status, d.getVar("CVE_PRODUCT") or ""): + return ("", "", "") return (status["mapping"], status["detail"], status["description"]) +def has_cve_product_match(detailed_status, products): + """ + Check product/vendor match between detailed_status from decode_cve_status and a string of + products (like from CVE_PRODUCT) + """ + for product in products.split(): + vendor = "*" + if ":" in product: + vendor, product = product.split(":", 1) + + if (vendor == detailed_status["vendor"] or detailed_status["vendor"] == "*") and \ + (product == detailed_status["product"] or detailed_status["product"] == "*"): + return True + + #if no match, return False + return False + def extend_cve_status(d): # do this only once in case multiple classes use this if d.getVar("CVE_STATUS_EXTENDED"): diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py index 0e9c6fa..539901f 100644 --- a/meta/lib/oe/spdx30_tasks.py +++ b/meta/lib/oe/spdx30_tasks.py @@ -470,7 +470,6 @@ def _get_cves_info(d): for cve_id in (d.getVarFlags("CVE_STATUS") or {}): mapping, detail, description = oe.cve_check.decode_cve_status(d, cve_id) if not mapping or not detail: - bb.warn(f"Skipping {cve_id} — missing or unknown CVE status") continue yield cve_id, mapping, detail, description patched_cves.discard(cve_id)