feat(yocto): Yocto's own cve-check verdicts join the scan (#150) #854

Merged
sharang merged 1 commits from feat/yocto-cve-check into main 2026-11-04 23:00:08 +00:00
Owner

#150, PR 3 of the plan. It builds on #853 (build outputs). Tracker #167.

Why

With INHERIT += "cve-check", a Yocto build writes <image>.json next to the image. For every recipe in the image it lists the CVEs NVD records, each Patched, Ignored (with the CVE_STATUS reason) or Unpatched. That is Yocto's own verdict on everything it checked, wider than the SPDX's "CVEs fixed".

What

  • pipeline::yocto_cve_check reads the report into recipe, version and issues: status, detail (reason), description (note), NVD summary and CVSS v3. Size is capped at 256 MB.
  • Upload: the report goes up as a build_output, like the image SPDX. read_build_outputs tells the two apart by content: a JSON object with package/version, or a zstd archive. An unreadable file gets a build_spdx note that names both expected forms.
  • yocto_build::Built takes the reports. On an alert's CVE:
    1. Yocto's verdict comes first:
      • Patched becomes fixed.
      • Ignored maps through the same table as the recipes' CVE_STATUS: not-applicable-* → not_affected, disputed/upstream-wontfix → under_investigation, cpe-incorrect → not_affected (component not present).
      • Unpatched gives no statement.
      • The statement text names the reason and the recipe's note.
    2. Then the SPDX's fixed list.
    3. Then the recipe in the tree.
  • Unpatched CVEs the NVD match missed (another version range, or a CPE that NVD's API matches differently) are added as alerts through record_nvd, with NVD's description and score from the report. This only happens for recipe components of the scan.
  • yocto_inventory::status_statement is now pub(crate).

Fixture

fixtures/yocto/core-image-minimal-qemuarm64.rootfs.cve.json is a trimmed copy of the real report from the ferrite build (scarthgap 5.0.21, cve-check run on 04.11.). It covers:

  • glibc: Patched, cpe-stable-backport, Ignored disputed, and 3 Unpatched;
  • busybox: Patched;
  • zlib: Patched and Ignored not-applicable-config.

Summaries are shortened; there is no personal data.

Tests

  • Unit tests:
    • parsing and statuses;
    • recognising the file by its first bytes;
    • refusing an SPDX document;
    • verdict order: the cve-check verdict before the SPDX fixed list and the recipe, Ignored mapped, Unpatched without a statement;
    • missing Unpatched CVEs added only for known components.
  • CI only.

🤖 Generated with Claude Code

#150, PR 3 of the plan. It builds on #853 (build outputs). Tracker #167. ## Why With `INHERIT += "cve-check"`, a Yocto build writes `<image>.json` next to the image. For every recipe in the image it lists the CVEs NVD records, each **Patched**, **Ignored** (with the `CVE_STATUS` reason) or **Unpatched**. That is Yocto's own verdict on everything it checked, wider than the SPDX's "CVEs fixed". ## What - **`pipeline::yocto_cve_check`** reads the report into recipe, version and issues: status, `detail` (reason), `description` (note), NVD summary and CVSS v3. Size is capped at 256 MB. - **Upload:** the report goes up as a `build_output`, like the image SPDX. `read_build_outputs` tells the two apart by content: a JSON object with `package`/`version`, or a zstd archive. An unreadable file gets a `build_spdx` note that names both expected forms. - **`yocto_build::Built`** takes the reports. On an alert's CVE: 1. Yocto's verdict comes first: - Patched becomes `fixed`. - Ignored maps through the same table as the recipes' `CVE_STATUS`: `not-applicable-*` → `not_affected`, `disputed`/`upstream-wontfix` → `under_investigation`, `cpe-incorrect` → `not_affected` (component not present). - Unpatched gives no statement. - The statement text names the reason and the recipe's note. 2. Then the SPDX's fixed list. 3. Then the recipe in the tree. - **Unpatched CVEs the NVD match missed** (another version range, or a CPE that NVD's API matches differently) are added as alerts through `record_nvd`, with NVD's description and score from the report. This only happens for recipe components of the scan. - `yocto_inventory::status_statement` is now `pub(crate)`. ## Fixture `fixtures/yocto/core-image-minimal-qemuarm64.rootfs.cve.json` is a trimmed copy of the real report from the ferrite build (scarthgap 5.0.21, cve-check run on 04.11.). It covers: - glibc: Patched, `cpe-stable-backport`, Ignored `disputed`, and 3 Unpatched; - busybox: Patched; - zlib: Patched and Ignored `not-applicable-config`. Summaries are shortened; there is no personal data. ## Tests - Unit tests: - parsing and statuses; - recognising the file by its first bytes; - refusing an SPDX document; - verdict order: the cve-check verdict before the SPDX fixed list and the recipe, Ignored mapped, Unpatched without a statement; - missing Unpatched CVEs added only for known components. - CI only. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sharang added 1 commit 2026-11-04 22:43:04 +00:00
feat(yocto): Yocto's own cve-check verdicts join the scan (#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 4m26s
CI / Check (pull_request) Successful in 16m38s
009ad2042a
With INHERIT += "cve-check" a build writes <image>.json next to the
image: per recipe the CVEs NVD records for it, each Patched, Ignored
(with the CVE_STATUS reason) or Unpatched. It is uploaded as a build
output like the image SPDX; the scan tells the two apart by content.

- pipeline::yocto_cve_check reads the report (size-capped).
- Built takes the reports: Yocto's verdict on an alert's CVE comes
  first (Patched is fixed, Ignored as the reason maps, the same table as
  the recipes' CVE_STATUS; the note is kept), then the SPDX's fixed
  list, then the recipe in the tree.
- CVEs cve-check found unpatched that the NVD match missed are added as
  alerts on the scan's recipe components, with NVD's description and
  score from the report.

The fixture is a trimmed copy of a real scarthgap 5.0.21 report for
core-image-minimal (glibc, busybox and zlib with every status).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang merged commit c2fbffd2c6 into main 2026-11-04 23:00:08 +00:00
Sign in to join this conversation.