Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Benjamin Robin (Schneider Electric)" <benjamin.robin@bootlin.com>
To: openembedded-core@lists.openembedded.org
Cc: "Benjamin Robin (Schneider Electric)"
	<benjamin.robin@bootlin.com>,
	thomas.petazzoni@bootlin.com, mathieu.dubois-briand@bootlin.com,
	miquel.raynal@bootlin.com, antonin.godard@bootlin.com,
	kamel.bouhara@bootlin.com, pascal.eberhard@se.com,
	jpewhacker@gmail.com
Subject: [scarthgap v2 1/5] spdx30: provide all CVE_STATUS, not only Patched status
Date: Fri, 21 Nov 2025 10:54:09 +0100	[thread overview]
Message-ID: <20251121095415.288301-2-benjamin.robin@bootlin.com> (raw)
In-Reply-To: <20251121095415.288301-1-benjamin.robin@bootlin.com>

In scarthgap, the `oe.cve_check.get_patched_cves()` method only returns
CVEs with a "Patched" status. We want to retrieve all annotations,
including those with an "Ignored" status. Therefore, to avoid modifying
the current API, we integrate the logic for retrieving all CVE_STATUS
values ​​directly into `spdx30_task`.

Signed-off-by: Benjamin Robin (Schneider Electric) <benjamin.robin@bootlin.com>
---
 meta/lib/oe/spdx30_tasks.py | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
index 8115088ab8ef..e6f2beb06f4e 100644
--- a/meta/lib/oe/spdx30_tasks.py
+++ b/meta/lib/oe/spdx30_tasks.py
@@ -452,6 +452,22 @@ def set_purposes(d, element, *var_names, force_purposes=[]):
     ]
 
 
+def _get_cves_info(d):
+    patched_cves = oe.cve_check.get_patched_cves(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)
+
+    # decode_cve_status is decoding CVE_STATUS, so patch files need to be hardcoded
+    for cve_id in patched_cves:
+        # fix-file-included is not available in scarthgap
+        yield cve_id, "Patched", "backported-patch", None
+
+
 def create_spdx(d):
     def set_var_field(var, obj, name, package=None):
         val = None
@@ -501,20 +517,7 @@ def create_spdx(d):
     # Add CVEs
     cve_by_status = {}
     if include_vex != "none":
-        patched_cves = oe.cve_check.get_patched_cves(d)
-        for cve_id in patched_cves:
-            # decode_cve_status is decoding CVE_STATUS, so patch files need to be hardcoded
-            if cve_id in (d.getVarFlags("CVE_STATUS") or {}):
-                mapping, detail, description = oe.cve_check.decode_cve_status(d, cve_id)
-            else:
-                mapping = "Patched"
-                detail = "backported-patch"  # fix-file-included is not available in scarthgap
-                description = None
-
-            if not mapping or not detail:
-                bb.warn(f"Skipping {cve_id} — missing or unknown CVE status")
-                continue
-
+        for cve_id, mapping, detail, description in _get_cves_info(d):
             # If this CVE is fixed upstream, skip it unless all CVEs are
             # specified.
             if (
-- 
2.51.2



  reply	other threads:[~2025-11-21  9:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21  9:54 [scarthgap v2 0/5] backport: allow to extract all CVE_STATUS info Benjamin Robin (Schneider Electric)
2025-11-21  9:54 ` Benjamin Robin (Schneider Electric) [this message]
2025-11-21  9:54 ` [scarthgap v2 2/5] vex.bbclass: add a new class Benjamin Robin (Schneider Electric)
2025-11-21  9:54 ` [scarthgap v2 3/5] cve-check: extract extending CVE_STATUS to library function Benjamin Robin (Schneider Electric)
2025-11-21  9:54 ` [scarthgap v2 4/5] spdx: extend CVE_STATUS variables Benjamin Robin (Schneider Electric)
2025-11-21  9:54 ` [scarthgap v2 5/5] vex: fix rootfs manifest Benjamin Robin (Schneider Electric)
2025-11-21 10:35 ` [OE-core] [scarthgap v2 0/5] backport: allow to extract all CVE_STATUS info Marta Rybczynska
2025-11-21 10:42   ` Benjamin ROBIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251121095415.288301-2-benjamin.robin@bootlin.com \
    --to=benjamin.robin@bootlin.com \
    --cc=antonin.godard@bootlin.com \
    --cc=jpewhacker@gmail.com \
    --cc=kamel.bouhara@bootlin.com \
    --cc=mathieu.dubois-briand@bootlin.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=pascal.eberhard@se.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox