feat(sbom): a machine's SBOM, its parts with their suppliers (#1026) #1036

Merged
sharang merged 1 commits from feat/machine-sbom into main 2026-11-17 10:10:36 +00:00
Owner

Part of #1026 (phase 2 of epic #1029), and its first PR.

Decision: a machine is a project of kind product

#1026 left open whether a project gets a "product" flag or every project counts as one. The registry already gives each project a kind: product (a customer's product or machine) or topic (such as the CRA or the Data Act). So a machine is a project of kind product, and this needs no new flag. A topic project has no machine documents and gets 422.

What

GET /api/v1/projects/{id}/sbom returns the machine's SBOM as CycloneDX 1.6:

  • The machine is metadata.component, of type device, with bom-ref urn:pruefwerk:project:<id>.
  • Each part is one of the machine's non-archived targets, listed as a component with:
    • its supplier: the supplier of a bought-in component (#1025), or the workspace for a part made in-house;
    • its version: the supplier's version, or else when its SBOM data was last compiled, as for a target;
    • bom-ref urn:pruefwerk:target:<id>, so two parts, or a part and the machine, never collide however they are named.
  • The parts' components are listed once each, even when two parts contain one. The supplier's product entry (supplier-product) is the part itself, not one of its components.
  • Dependencies: the machine depends on its parts, and each part on its own components. These are the top-level dependencies the CRA asks for. The graph is stated incomplete, as for a target.
  • Vulnerabilities: the known vulnerabilities point at the shared components. This listing moved into a helper (cdx_known_vulnerabilities) that the target SBOM uses too.
  • Refusals:
    • 404 for a project the tenant doesn't have;
    • 422 for a topic project, or one without targets (an empty SBOM would read as "nothing to fix");
    • 413 past 100,000 components, as for a target.
  • Without a registry (dev), the machine is named by its id.

The CycloneDX schema helpers of the core tests moved to compliance-core/tests/common, so both schema tests share them.

Not in this PR

  • Machine VEX and CSAF: these wait for #1015. The VEX and CSAF builders key each statement by CVE and component purl within one product. Across a machine, the same purl in two parts with different statuses would collapse into one statement. The fix is a machine › part › component product tree in vex_docs/csaf_docs, which #1015 also changes.
  • The machine's CVE view: its shape follows the machine page, which needs a mockup first.
  • The machine's evidence pack: next.

Tests

  • Core:
    • the machine SBOM validates against CycloneDX 1.6;
    • every bom-ref is unique, and every dependsOn resolves;
    • each part has its supplier and version, and a shared component is listed once;
    • a part named like the machine doesn't collide.
  • Integration:
    • in-house and bought-in parts are listed with their suppliers;
    • the archived target and the target of another machine are left out;
    • the supplier's product entry is not a component;
    • a project without targets gets 422.
  • Local runs: clippy for core and agent (--all-targets -D warnings) is clean, and the core and agent test suites are green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

Part of #1026 (phase 2 of epic #1029), and its first PR. ## Decision: a machine is a project of kind `product` #1026 left open whether a project gets a "product" flag or every project counts as one. The registry already gives each project a `kind`: `product` (a customer's product or machine) or `topic` (such as the CRA or the Data Act). So a machine is a project of kind `product`, and this needs no new flag. A topic project has no machine documents and gets 422. ## What `GET /api/v1/projects/{id}/sbom` returns the machine's SBOM as CycloneDX 1.6: - **The machine** is `metadata.component`, of type `device`, with `bom-ref` `urn:pruefwerk:project:<id>`. - **Each part** is one of the machine's non-archived targets, listed as a component with: - its `supplier`: the supplier of a bought-in component (#1025), or the workspace for a part made in-house; - its version: the supplier's version, or else when its SBOM data was last compiled, as for a target; - `bom-ref` `urn:pruefwerk:target:<id>`, so two parts, or a part and the machine, never collide however they are named. - **The parts' components** are listed once each, even when two parts contain one. The supplier's product entry (`supplier-product`) is the part itself, not one of its components. - **Dependencies:** the machine depends on its parts, and each part on its own components. These are the top-level dependencies the CRA asks for. The graph is stated `incomplete`, as for a target. - **Vulnerabilities:** the known vulnerabilities point at the shared components. This listing moved into a helper (`cdx_known_vulnerabilities`) that the target SBOM uses too. - **Refusals:** - 404 for a project the tenant doesn't have; - 422 for a topic project, or one without targets (an empty SBOM would read as "nothing to fix"); - 413 past 100,000 components, as for a target. - **Without a registry (dev),** the machine is named by its id. The CycloneDX schema helpers of the core tests moved to `compliance-core/tests/common`, so both schema tests share them. ## Not in this PR - **Machine VEX and CSAF:** these wait for #1015. The VEX and CSAF builders key each statement by CVE and component purl within one product. Across a machine, the same purl in two parts with different statuses would collapse into one statement. The fix is a machine › part › component product tree in `vex_docs`/`csaf_docs`, which #1015 also changes. - **The machine's CVE view:** its shape follows the machine page, which needs a mockup first. - **The machine's evidence pack:** next. ## Tests - **Core:** - the machine SBOM validates against CycloneDX 1.6; - every `bom-ref` is unique, and every `dependsOn` resolves; - each part has its supplier and version, and a shared component is listed once; - a part named like the machine doesn't collide. - **Integration:** - in-house and bought-in parts are listed with their suppliers; - the archived target and the target of another machine are left out; - the supplier's product entry is not a component; - a project without targets gets 422. - **Local runs:** clippy for core and agent (`--all-targets -D warnings`) is clean, and the core and agent test suites are green. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang added 1 commit 2026-11-17 09:48:25 +00:00
feat(sbom): a machine's SBOM, its parts with their suppliers (#1026)
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 5m9s
CI / Check (pull_request) Successful in 21m17s
87d8386277
A machine is a registry project of kind `product`, made of its targets:
in-house ones and components bought in (#1025). GET
/api/v1/projects/{id}/sbom returns its CycloneDX 1.6 SBOM: the machine as
a device, each part with its supplier (the workspace for one made
in-house) and the supplier's version, the parts' components once each,
and a graph of the machine depending on its parts and each part on its
own components. Part refs are built from target ids, so names never
collide. The supplier's product entry is the part, not a component of
it; archived targets are left out.

The vulnerability listing of the target SBOM moves into its own helper,
shared by both; the CycloneDX schema test helpers move to tests/common.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang merged commit 72ef09b981 into main 2026-11-17 10:10:36 +00:00
sharang deleted branch feat/machine-sbom 2026-11-17 10:10:37 +00:00
Sign in to join this conversation.