feat(sbom): explain an empty or incomplete SBOM with findings (#979) #985

Merged
sharang merged 1 commits from feat/979-empty-sbom-finding into main 2026-11-12 09:21:59 +00:00
Owner

What

An upload of source code without a manifest or lockfile gave an empty SBOM with no explanation. A new check, sbom-coverage, now reports why the SBOM is empty or incomplete, and the SBOM page explains it.

Findings (scanner sbom-coverage, scan type SBOM, CWE-1104, mapped to cra-ai-23)

  • sbom-no-manifest, Medium. One finding per ecosystem. It fires when the code has files in a language with a package manager (Python, JS/TS, Rust, Go, Java/Kotlin, C#, PHP, Ruby, Dart) and no manifest or lockfile for that language exists anywhere outside vendor directories. It also needs the SBOM to list no components of that ecosystem's purl type, since committed jars and DLLs are already an SBOM.
    • It never fires when the scanned languages include C, C++ or BitBake, for a Yocto layer tree, when the tree's components come from its sources (embedded headers, codesys, Yocto recipes), or when the target has a firmware SBOM (Firmwerk entries in the DB).
    • PLC targets never reach this stage.
  • sbom-dependencies-unresolved, Low. One finding per entry of unlocked_ecosystems, which is the same gap the run already lists under sbom_dependencies / Nicht ausgeführt. Its file_path is the manifest. Legacy build systems (ADT, Unity without UPM) are left out because they already get legacy-build-system-no-sbom.
  • Text. Each finding says why the SBOM is empty or incomplete. The remediation gives a concrete example per ecosystem, for instance pip freeze > requirements.txt, or pyproject.toml with uv lock / poetry lock; npm install writes package-lock.json; Cargo.lock; go mod tidy.
  • Lifecycle. The fingerprint is (target, rule, ecosystem or manifest), with no file line, so content fingerprinting leaves it alone. The scanner is marked completed on every code scan, so resolve_missing closes a finding at the next scan that no longer reports it.
  • CRA mapping. The binding is added under cra-ai-23 in the control map, and control_refs is stamped when the finding is created, because the LLM control triage only judges findings that have a code region. sbom-coverage joins COMPONENT_TOOLS, so cra-ai-23 stays component-only.
    • Visible effect: with an open coverage finding, the cra-ai-23 tile reads not satisfied instead of "not assessed: dependencies unresolved". cra-ai-22/33 keep their reason.
  • Nothing is guessed, and no code is run to resolve dependencies.
  • dart is now detected as a source language.

SBOM page

When a target is selected, no other filter is set and the table is empty, the page shows a card instead of a bare table. The card explains where the SBOM comes from and that "empty" does not mean "no libraries". It then lists the target's open sbom-coverage findings, each with its example and a link to the finding. Without such a finding (all targets, or C/C++ code) it shows a general example. The text is in DE and EN. To support this, GET /api/v1/findings takes a scanner filter.

Docs

  • docs/guide/sbom.md: new section "When the SBOM is empty or incomplete", and the empty state in the Packages tab.
  • docs/guide/findings.md: new finding type.
  • docs/guide/scanning.md: the Nicht ausgeführt row now points to the new finding.

Notes

  • The finding text is in English only, like every finding in the codebase; the dashboard has no translation by rule. The SBOM page's empty state is in DE and EN.
  • Existing gap, unchanged: unlocked_ecosystems checks npm, Python and Cargo at the root only. A nested backend/pyproject.toml without a lockfile therefore produces neither finding.
  • Existing issue, not touched: the SBOM stage replaces the stored components only when the new list is non-empty (if !sbom_entries.is_empty()). A target whose manifest was deleted keeps its old components and never shows the empty state.

Tests

  • cargo test -p compliance-agent --lib: coverage (9 tests: every ecosystem, the vendor, C/C++, BitBake, firmware and Yocto gates, Dart, legacy exclusion, mapping matches the control map), evidence (23, including the new cra-ai-23 tile test), sbom (134) and languages all pass.
  • cargo test -p control-map and the dashboard lib tests (server feature) pass.
  • cargo fmt --all --check passes. cargo clippy --all-targets -D warnings is clean for core, agent, control-map, mcp and the dashboard (server and web).
  • Not run: the MongoDB integration tests, and a look at the dashboard in a browser.

Closes #979

🤖 Generated with Claude Code

## What An upload of source code without a manifest or lockfile gave an empty SBOM with no explanation. A new check, `sbom-coverage`, now reports why the SBOM is empty or incomplete, and the SBOM page explains it. ### Findings (scanner `sbom-coverage`, scan type SBOM, CWE-1104, mapped to `cra-ai-23`) - **`sbom-no-manifest`, Medium.** One finding per ecosystem. It fires when the code has files in a language with a package manager (Python, JS/TS, Rust, Go, Java/Kotlin, C#, PHP, Ruby, Dart) and no manifest or lockfile for that language exists anywhere outside vendor directories. It also needs the SBOM to list no components of that ecosystem's purl type, since committed jars and DLLs are already an SBOM. - It never fires when the scanned languages include C, C++ or BitBake, for a Yocto layer tree, when the tree's components come from its sources (`embedded` headers, `codesys`, Yocto recipes), or when the target has a firmware SBOM (Firmwerk entries in the DB). - PLC targets never reach this stage. - **`sbom-dependencies-unresolved`, Low.** One finding per entry of `unlocked_ecosystems`, which is the same gap the run already lists under `sbom_dependencies` / *Nicht ausgeführt*. Its `file_path` is the manifest. Legacy build systems (ADT, Unity without UPM) are left out because they already get `legacy-build-system-no-sbom`. - **Text.** Each finding says why the SBOM is empty or incomplete. The remediation gives a concrete example per ecosystem, for instance `pip freeze > requirements.txt`, or `pyproject.toml` with `uv lock` / `poetry lock`; `npm install` writes `package-lock.json`; `Cargo.lock`; `go mod tidy`. - **Lifecycle.** The fingerprint is (target, rule, ecosystem or manifest), with no file line, so content fingerprinting leaves it alone. The scanner is marked completed on every code scan, so `resolve_missing` closes a finding at the next scan that no longer reports it. - **CRA mapping.** The binding is added under `cra-ai-23` in the control map, and `control_refs` is stamped when the finding is created, because the LLM control triage only judges findings that have a code region. `sbom-coverage` joins `COMPONENT_TOOLS`, so cra-ai-23 stays component-only. - Visible effect: with an open coverage finding, the cra-ai-23 tile reads **not satisfied** instead of "not assessed: dependencies unresolved". cra-ai-22/33 keep their reason. - Nothing is guessed, and no code is run to resolve dependencies. - `dart` is now detected as a source language. ### SBOM page When a target is selected, no other filter is set and the table is empty, the page shows a card instead of a bare table. The card explains where the SBOM comes from and that "empty" does not mean "no libraries". It then lists the target's open `sbom-coverage` findings, each with its example and a link to the finding. Without such a finding (all targets, or C/C++ code) it shows a general example. The text is in DE and EN. To support this, `GET /api/v1/findings` takes a `scanner` filter. ### Docs - `docs/guide/sbom.md`: new section "When the SBOM is empty or incomplete", and the empty state in the Packages tab. - `docs/guide/findings.md`: new finding type. - `docs/guide/scanning.md`: the *Nicht ausgeführt* row now points to the new finding. ## Notes - The finding text is in English only, like every finding in the codebase; the dashboard has no translation by rule. The SBOM page's empty state is in DE and EN. - Existing gap, unchanged: `unlocked_ecosystems` checks npm, Python and Cargo at the root only. A nested `backend/pyproject.toml` without a lockfile therefore produces neither finding. - Existing issue, not touched: the SBOM stage replaces the stored components only when the new list is non-empty (`if !sbom_entries.is_empty()`). A target whose manifest was deleted keeps its old components and never shows the empty state. ## Tests - `cargo test -p compliance-agent --lib`: `coverage` (9 tests: every ecosystem, the vendor, C/C++, BitBake, firmware and Yocto gates, Dart, legacy exclusion, mapping matches the control map), `evidence` (23, including the new cra-ai-23 tile test), `sbom` (134) and `languages` all pass. - `cargo test -p control-map` and the dashboard lib tests (server feature) pass. - `cargo fmt --all --check` passes. `cargo clippy --all-targets -D warnings` is clean for core, agent, control-map, mcp and the dashboard (server and web). - Not run: the MongoDB integration tests, and a look at the dashboard in a browser. Closes #979 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sharang added 1 commit 2026-11-12 08:58:21 +00:00
feat(sbom): explain an empty or incomplete SBOM with findings (#979)
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 4m33s
CI / Check (pull_request) Successful in 22m28s
ad13e509a4
Source code without a manifest or lockfile gave an empty SBOM with no
explanation, which reads as "no libraries". Two findings of a new
sbom-coverage check now say why:

- sbom-no-manifest (Medium): code in a language with a package manager
  (Python, JS/TS, Rust, Go, Java/Kotlin, C#, PHP, Ruby, Dart) and no
  manifest or lockfile for it outside vendor directories, one per
  ecosystem. Never for C/C++, Yocto layers, or a tree whose components
  come from its sources (library headers, firmware, CODESYS).
- sbom-dependencies-unresolved (Low): a manifest whose dependencies were
  not resolved, one per manifest the SBOM stage already lists under
  sbom_dependencies; legacy build systems keep their own finding.

Each finding names a concrete way to add the missing file, maps to the
SBOM requirement (cra-ai-23, also bound in the control map) and closes at
the next scan that no longer reports it, as the check completes on every
code scan. Dart is now detected as a source language.

The SBOM page shows an explanation instead of an empty table: where the
SBOM comes from, the target's open findings with their examples and a
link, or a general example. The findings API takes a scanner filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang merged commit ca8a662b60 into main 2026-11-12 09:21:59 +00:00
Sign in to join this conversation.