From 7f5ddf69fc2a5dfab3141a3d0421d3131b760687 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar Date: Wed, 4 Nov 2026 23:18:50 +0000 Subject: [PATCH] feat(yocto): build output in the wizard and the guide (#150) (#855) --- .../src/components/artifact_upload.rs | 17 +++--- compliance-dashboard/src/i18n/texts.rs | 9 +++- .../src/infrastructure/onboarding.rs | 5 +- compliance-dashboard/src/pages/onboarding.rs | 5 +- docs/guide/yocto.md | 52 ++++++++++++++++++- 5 files changed, 75 insertions(+), 13 deletions(-) diff --git a/compliance-dashboard/src/components/artifact_upload.rs b/compliance-dashboard/src/components/artifact_upload.rs index 5a3a742..7ddfa59 100644 --- a/compliance-dashboard/src/components/artifact_upload.rs +++ b/compliance-dashboard/src/components/artifact_upload.rs @@ -64,13 +64,16 @@ pub fn ArtifactUpload(target_id: String, on_uploaded: EventHandler<()>) -> Eleme } } } - div { class: "form-group", - label { {common::ARCHIVE_PASSWORD.get(lang)} } - input { - r#type: "password", - autocomplete: "off", - value: "{password}", - oninput: move |e| password.set(e.value()), + // Firmware images and build outputs are never unpacked. + if kind() != "firmware_image" && kind() != "build_output" { + div { class: "form-group", + label { {common::ARCHIVE_PASSWORD.get(lang)} } + input { + r#type: "password", + autocomplete: "off", + value: "{password}", + oninput: move |e| password.set(e.value()), + } } } button { diff --git a/compliance-dashboard/src/i18n/texts.rs b/compliance-dashboard/src/i18n/texts.rs index 78fe538..5f8b8d2 100644 --- a/compliance-dashboard/src/i18n/texts.rs +++ b/compliance-dashboard/src/i18n/texts.rs @@ -1315,7 +1315,7 @@ pub mod kinds { pub const MACHINE_TYPES: usize = 4; /// The artifact kinds, in the order the forms offer them. - pub const ARTIFACT_KINDS: [(&str, Text); 8] = [ + pub const ARTIFACT_KINDS: [(&str, Text); 9] = [ ( "git_repo", Text { @@ -1337,6 +1337,13 @@ pub mod kinds { en: "Firmware image", }, ), + ( + "build_output", + Text { + de: "Build-Ergebnisse (Yocto: Image-SPDX .spdx.tar.zst, cve-check .json)", + en: "Build output (Yocto: image SPDX .spdx.tar.zst, cve-check .json)", + }, + ), ( "mobile_package", Text { diff --git a/compliance-dashboard/src/infrastructure/onboarding.rs b/compliance-dashboard/src/infrastructure/onboarding.rs index 8b657dc..fc02338 100644 --- a/compliance-dashboard/src/infrastructure/onboarding.rs +++ b/compliance-dashboard/src/infrastructure/onboarding.rs @@ -229,7 +229,7 @@ pub fn demo_seed_default_selection(targets: &[DemoSeedTarget], source_only: bool pub fn is_file_kind(kind: &str) -> bool { matches!( kind, - "plc_project" | "firmware_image" | "source_archive" | "mobile_package" + "plc_project" | "firmware_image" | "source_archive" | "mobile_package" | "build_output" ) } @@ -299,7 +299,7 @@ pub fn validate_artifact_ref(kind: &str, source_ref: &str) -> Option { "container_image" => { (!no_space).then(|| "Enter an image ref, e.g. registry/name:tag".to_string()) } - "source_archive" | "firmware_image" | "mobile_package" | "plc_project" => { + "source_archive" | "firmware_image" | "mobile_package" | "plc_project" | "build_output" => { (!no_space).then(|| "Enter a path or URL (no spaces)".to_string()) } // plaintext_description (and anything unknown): accept free-form text. @@ -633,6 +633,7 @@ mod tests { assert_eq!(plc_format_for("pump_station.st"), Some("structured_text")); assert_eq!(plc_format_for("firmware.bin"), None); assert!(is_file_kind("source_archive") && !is_file_kind("git_repo")); + assert!(is_file_kind("build_output")); } #[test] diff --git a/compliance-dashboard/src/pages/onboarding.rs b/compliance-dashboard/src/pages/onboarding.rs index a25911c..aef7a15 100644 --- a/compliance-dashboard/src/pages/onboarding.rs +++ b/compliance-dashboard/src/pages/onboarding.rs @@ -405,8 +405,9 @@ pub fn OnboardingPage() -> Element { span { style: "opacity: 0.7;", "{kind_label(&pf.kind)} ({tx::FILE_SUFFIX.get(lang)}): " } "{pf.filename} ({format_bytes(pf.file.size(), lang)})" } - // Firmware images are never unpacked; archives may be locked. - if pf.kind != "firmware_image" { + // Firmware images and build outputs are never unpacked; + // archives may be locked. + if pf.kind != "firmware_image" && pf.kind != "build_output" { input { r#type: "password", autocomplete: "off", diff --git a/docs/guide/yocto.md b/docs/guide/yocto.md index 21671c6..a242c54 100644 --- a/docs/guide/yocto.md +++ b/docs/guide/yocto.md @@ -299,10 +299,60 @@ recipe from a layer that is not in the tree is marked. The CRA state of the SBOM requirement stays **Teilweise geprüft** until an image SBOM from a build can be imported (tier 2). +## Im Image (gebaut): the build's own output + +A build knows what it installed. Upload what it wrote about the image, and +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//.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 cve-check report** (optional): `tmp/deploy/images//.json`, + written when the build inherits `cve-check` (`INHERIT += "cve-check"` in + `local.conf`). + +**What the SPDX gives.** One component per recipe that has packages in the image +(BusyBox's `busybox`, `busybox-syslog` and `busybox-udhcpc` are one component), +with the version the build used, the declared licence and the CPE. These carry +the badge **Im Image** with the tooltip *installed by the build*. They are joined +with the recipe inventory by recipe name: the version the build used wins over the +`PV` in the tree (`busybox_1.35.0.bb` in the layer, 1.36.1 built), and both +evidence lines stay. For an image the SPDX covers, a recipe the image recipes +declare but the build did not install loses its declared marking. Recipes that +only the build lists (from Poky or another layer not in the tree) are added. The +CVEs the recipes' patches fixed (*CVEs fixed* in the SPDX) are stated as +**fixed** (VEX). + +**What cve-check adds.** Yocto's verdict on every CVE it checked comes first: + +| cve-check | VEX statement | +|---|---| +| Patched (also `fixed-version`, `cpe-stable-backport`, `backported-patch`) | fixed | +| Ignored `not-applicable-config`, `not-applicable-platform` | not affected (vulnerable code not present) | +| Ignored `cpe-incorrect` | not affected (component not present) | +| Ignored `disputed`, `upstream-wontfix`, `ignored` | under investigation, with the recipe's note | +| Unpatched | none: the CVE stays open | + +A CVE cve-check found unpatched that Prüfwerk's own NVD match did not is added +with the description and score from the report. + +**Volume.** A real image includes the kernel (`linux-yocto`), and NVD records +thousands of CVEs for it. The build's SPDX and cve-check mark almost all of them +as patched, so they arrive as **fixed**; the ones Yocto reports unpatched stay +open. + +**On the run.** A file that is neither an image SPDX archive nor a cve-check +report is listed under **Build-SPDX (Yocto-Image)** and skipped. So is a package +the image lists without its document in the archive. A new upload starts a new +scan. A target needs the layer tree (git or archive) next to the build output +for now. + ## What is planned | 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** | `tmp/deploy/spdx` (SPDX 3.0, or 2.2 up to Scarthgap), `*.vex.json`, the image `.manifest`, the kernel `.config` | **SPDX import** into the SBOM view and CycloneDX export; **sbom-cve-check** with the Yocto VEX annotations; kernel CVEs filtered by the configuration; a nightly re-check without a rebuild | +| **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, a target with build output only | | **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 |