Skip to contentSkip to conversation

python3-sbom-cve-check: move from devtools/python to devtools/sbom-cve-check

PATCH New Ross Burton 1 participant 3 messages Apr 9

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 python3-sbom-cve-check: move from devtools/python to devtools/sbom-cve-check

Move the tool recipe from the catch-all python/ directory to be alongside the recipes that fetch the databases for the tool.

---
 .../{python => sbom-cve-check}/python3-sbom-cve-check_1.2.0.bb    | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename meta/recipes-devtools/{python => sbom-cve-check}/python3-sbom-cve-check_1.2.0.bb (100%)
meta/recipes-devtools/sbom-cve-check/python3-sbom-cve-check_1.2.0.bb renamed from meta/recipes-devtools/python/python3-sbom-cve-check_1.2.0.bb +0 -0
similarity index 100%
rename from meta/recipes-devtools/python/python3-sbom-cve-check_1.2.0.bb
rename to meta/recipes-devtools/sbom-cve-check/python3-sbom-cve-check_1.2.0.bb
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/3 python3-sbom-cve-check: fix the version attribute in the Yocto-style JSON

The type of the version was an integer, but it should be a string.

---
 ...-correct-type-for-the-version-attrib.patch | 31 +++++++++++++++++++
 .../python3-sbom-cve-check_1.2.0.bb           |  2 ++
 2 files changed, 33 insertions(+)
 create mode 100644 meta/recipes-devtools/sbom-cve-check/files/0001-export_yocto-use-correct-type-for-the-version-attrib.patch
meta/recipes-devtools/sbom-cve-check/files/0001-export_yocto-use-correct-type-for-the-version-attrib.patch new file +31 -0
new file mode 100644
index 00000000000..392f0b99ea7
@@ -0,0 +1,31 @@
+From 1a5ae49c520d3569ed12f0c6373b4223d428f92b Mon Sep 17 00:00:00 2001
+From: Ross Burton <[email protected]>
+Date: Thu, 9 Apr 2026 11:55:19 +0100
+Subject: [PATCH] export_yocto: use correct type for the version attribute
+
+This should be a string, not an integer:
+
+https://git.openembedded.org/openembedded-core/tree/meta/classes/cve-check.bbclass?h=yocto-5.2.4#n235
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <[email protected]>
+---
+ src/sbom_cve_check/export/export_yocto.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sbom_cve_check/export/export_yocto.py b/src/sbom_cve_check/export/export_yocto.py
+index c8261f4..78d72c0 100644
+--- a/src/sbom_cve_check/export/export_yocto.py
++++ b/src/sbom_cve_check/export/export_yocto.py
+@@ -172,7 +172,7 @@ class YoctoCveCheckExport(BaseExport):
+         :return: Generator context.
+         """
+         yield
+-        json_obj = {"version": 1, "package": self._packages}
++        json_obj = {"version": "1", "package": self._packages}
+         with self._open_output_as_text() as f:
+             json.dump(json_obj, f, indent=2)
+ 
+-- 
+2.43.0
+
meta/recipes-devtools/sbom-cve-check/python3-sbom-cve-check_1.2.0.bb +2 -0
index 070e8789713..2a09d8ea4c3 100644
@@ -7,6 +7,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=570a9b3749dd0463a1778803b12a6dce"
 PYPI_PACKAGE = "sbom_cve_check"
 SRC_URI[sha256sum] = "0b01474c541fb4b9d29d36f86fae6d0f27ff2b991fcb59b2fbeb70c1eaa09664"
 
+SRC_URI += "file://0001-export_yocto-use-correct-type-for-the-version-attrib.patch"
+
 inherit pypi python_hatchling
 
 RDEPENDS:${PN} += " \
Signature · 1 line
2.43.0
#2 lore raw

PATCH 3/3 classes/sbom-cve-check: add variable to control the scope of the CVE scan

In reply to Ross Burton

Unless told otherwise, sbom-cve-check will only report on issues found in target recipes. Whilst this is the behaviour we want for image-based scanning, it's not the designed bevhaviour for recipe-based scanning.

Add a new variable SBOM_CVE_CHECK_SCAN_SCOPE that is used as the value passed with --export-process-native. Default this to "target" so the normal behaviour is unchanged, but set it to "both" in the sbom-cve-check-recipe class.

[1] https://sbom-cve-check.readthedocs.io/en/latest/export.html#export-options

---
 meta/classes/sbom-cve-check-common.bbclass | 9 ++++++++-
 meta/classes/sbom-cve-check-recipe.bbclass | 3 +++
 2 files changed, 11 insertions(+), 1 deletion(-)
meta/classes/sbom-cve-check-common.bbclass +8 -1
index 3db189d60de..6963ad71c61 100644
@@ -6,6 +6,10 @@ require conf/sbom-cve-check-config.inc
 
 SBOM_CVE_CHECK_DEPLOYDIR = "${WORKDIR}/sbom-cve-check/image-deploy"
 
+SBOM_CVE_CHECK_SCAN_SCOPE ?= "target"
+SBOM_CVE_CHECK_SCAN_SCOPE[doc] = "Whether to scan target and native, just target, or just native. \
+    Valid values are both, target, native."
+
 SBOM_CVE_CHECK_EXTRA_ARGS[doc] = "Allow to specify extra arguments to sbom-cve-check. \
     For example to add export flags for filtering (e.g., only export vulnerable CVEs). \
 "
@@ -54,6 +58,7 @@ def run_sbom_cve_check(d, sbom_path, export_base_name, export_link_name=None):
 
     dl_db_dir = d.getVar("SBOM_CVE_CHECK_DEPLOY_DB_DIR")
     out_deploy_dir = d.getVar("SBOM_CVE_CHECK_DEPLOYDIR")
+    scan_scope = d.getVar("SBOM_CVE_CHECK_SCAN_SCOPE")
 
     export_files = []
     for export_var in d.getVar("SBOM_CVE_CHECK_EXPORT_VARS").split():
@@ -70,7 +75,9 @@ def run_sbom_cve_check(d, sbom_path, export_base_name, export_link_name=None):
         d.expand("${STAGING_BINDIR_NATIVE}/sbom-cve-check"),
         "--sbom-path",
         sbom_path,
-        "--disable-auto-updates"
+        "--disable-auto-updates",
+        "--export-process-native",
+        scan_scope,
     ]
 
     for export_type, export_file, export_link in export_files:
meta/classes/sbom-cve-check-recipe.bbclass +3 -0
index 904ce57f5cc..c80b8ac83ff 100644
@@ -9,6 +9,9 @@
 
 inherit sbom-cve-check-common
 
+# Recipe-based scanning should cover both target and native components.
+SBOM_CVE_CHECK_SCAN_SCOPE = "both"
+
 python do_sbom_cve_check_recipe() {
     """
     Task: Run sbom-cve-check analysis on a recipe SBOM.
Signature · 1 line
2.43.0