feat(yocto): read the build's SPDX 3.0 image document (#150)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 4m42s
CI / Check (pull_request) Successful in 16m19s

With create-spdx-3.0 (the default from Styhead 5.1, available in
Scarthgap) a build writes one JSON-LD document per image,
<image>.spdx.json. pipeline::yocto_spdx3 reads it into the same
BuiltImage as the SPDX 2.2 reader (#852):

- the image is the archive package output by the rootfs build; its
  installed packages are that build's inputs (hasInput);
- each package's recipe is the build <recipe>:do_create_spdx:recipe that
  outputs it; version, CPE and homepage come from the package, the
  licence through hasConcludedLicense;
- the build's VEX: fixedIn becomes the fixed list, doesNotAffect a new
  not_affected list with its justification and impact statement.

Built takes the not-affected statements after Yocto's cve-check verdict
and before the fixed list and the recipes. The scan recognises an SPDX
3 document among the build outputs by its @context. The 2.2 reader's
component construction is shared (yocto_spdx::component).

The fixture is a trimmed copy of a real Scarthgap 5.0.21
core-image-minimal (qemuarm64) built with create-spdx-3.0: six recipes,
their licences and VEX, and one installed package without its element.
guide/yocto: what to upload for SPDX 3.0; tier 2 is done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-11-05 01:13:42 +01:00
1 parent 360c905894
commit b8e85842ec
7 files changed
+2933 -25

No files matched your search

+10 -4
View File
@@ -306,9 +306,15 @@ Prüfwerk takes that over the declared marking. Add each file to the target as
**Build-Ergebnisse (Yocto: Image-SPDX .spdx.tar.zst, cve-check .json)**, in the
wizard or under **Datei hinzufügen** on the target:
- **The image SPDX archive**: `tmp/deploy/images/<machine>/<image>.spdx.tar.zst`.
Yocto's `create-spdx` class (the default) writes it with every build. Since
Scarthgap (5.0) it is SPDX 2.2; Prüfwerk reads it as it is.
- **The image SBOM**, as the build wrote it:
- SPDX 2.2: `tmp/deploy/images/<machine>/<image>.spdx.tar.zst`, written by
Yocto's `create-spdx` class, the default up to Scarthgap (5.0);
- SPDX 3.0: `tmp/deploy/images/<machine>/<image>.spdx.json`, written by
`create-spdx-3.0`, the default from Styhead (5.1) and available in Scarthgap.
Its VEX statements (fixed, and not affected with the justification) are
taken over too.
Prüfwerk reads either as it is.
- **The cve-check report** (optional): `tmp/deploy/images/<machine>/<image>.json`,
written when the build inherits `cve-check` (`INHERIT += "cve-check"` in
`local.conf`).
@@ -384,5 +390,5 @@ joined as described above.
| Tier | Input | Analysis |
| --- | --- | --- |
| **1: layer tree** (in progress) | the layers in git, no build | **Recipe inventory**: every recipe's name, version, `SRC_URI`, `CVE_PRODUCT` and `CVE_STATUS`, matched against NVD; labelled as a recipe inventory, not the image's SBOM; the recipes an image recipe installs marked as declared. **Recipe lint**: done, see above |
| **2: build artefacts** (in progress) | the image `.spdx.tar.zst` (SPDX 2.2), the cve-check `.json`; later SPDX 3.0, `*.vex.json`, the kernel `.config` | **Done:** the image SPDX joins the SBOM (installed by the build), the cve-check verdicts become VEX, see *Im Image (gebaut)*. **Planned:** SPDX 3.0 (Styhead and later), kernel CVEs filtered by the configuration |
| **2: build artefacts** | the image SPDX (2.2 `.spdx.tar.zst` or 3.0 `.spdx.json`), the cve-check `.json`, the kernel CVE report from `improve_kernel_cve_report.py` | **Done:** the image SPDX joins the SBOM (installed by the build) with its VEX, the cve-check verdicts become VEX, kernel CVEs the configuration does not build are not affected, with or without the layer tree; see *Im Image (gebaut)* |
| **3: image / rootfs** | `.wic`, tar, ext4, squashfs | unpacking, ELF hardening of every binary, secrets and default credentials in the root filesystem; DAST and pentest only for a qemu build in an isolated sandbox |