feat(vex): VEX status on CVE alerts, OpenVEX and CycloneDX VEX, a valid CycloneDX SBOM (#498, 1/4)
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 / Check (pull_request) Canceled after 1m34s

Part 1 of #498 (VEX and CSAF for CRA vulnerability handling): the VEX
state, its API and the two VEX exports. The dashboard (2/4), the CSAF
advisory draft (3/4) and the ENISA report drafts (4/4) follow.

- compliance_core::models::vex: VexStatus (under_investigation, affected,
  not_affected, fixed), the five OpenVEX justifications, VexAssessment
  (who, when, by_scan). validate(): not_affected needs a justification or
  impact statement, affected an action statement.
- CveAlert gains `vex` and `resolved_at` (both skipped when empty, so the
  scan's upsert never wipes a statement).
- pipeline::vex_lifecycle: an alert reported again is open and loses a
  `fixed` the scan stated; one a complete lookup no longer finds is
  resolved, and becomes `fixed` (by_scan) unless a person stated
  not_affected/fixed. Alerts were never resolved before.
- API: GET /api/v1/targets/{id}/cves, PATCH /api/v1/cves/{id}/vex (422
  with the reason when incomplete), GET /api/v1/targets/{id}/vex
  ?format=openvex|cyclonedx. Writes go through the role gate and the
  support audit like any other.
- compliance_core::vex_docs: OpenVEX 0.2.0 and CycloneDX 1.5 VEX (the SBOM
  plus vulnerabilities with analysis); the status/justification mapping
  to CycloneDX is documented in the module and the guide.
- sbom_docs CycloneDX fixed: it put `vulnerabilities` inside components
  (invalid, components forbid other properties); now top-level, with
  bom-refs on every component and the product (pkg:generic/<target>), a
  serial number, metadata.timestamp/tools, and licenses as SPDX id
  (checked against CycloneDX's own SPDX list), expression or name.
- Evidence pack: vex.openvex.json and vex.cdx.json.
- Vendored schemas (compliance-core/schemas, provenance README):
  CycloneDX 1.5 + SPDX + JSF (Apache-2.0), OpenVEX 0.2.0 (CC0).
- Tests: the SBOM and both VEX documents validate against the official
  schemas (jsonschema, dev-only), with negative controls (nested
  vulnerabilities, a name as SPDX id, a statement without status fail);
  statement validation; Mongo: the lifecycle (scan fixes the unassessed
  and affected, keeps a person's not_affected, withdraws its fixed when
  the CVE returns, does nothing on an incomplete lookup).
- Docs (sbom guide); staging test plan: check 22.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-10-06 13:46:14 +02:00
1 parent b7dbd8f196
commit 058266e5ac
26 files changed
+6472 -40

No files matched your search

+54
View File
@@ -195,6 +195,60 @@ Copyleft-licensed dependencies can require you to release your source code under
The evidence pack on the target's page also contains both formats.
The CycloneDX document follows the CycloneDX 1.5 schema: every component has
a `bom-ref` (its purl, or `<package manager>:<name>@<version>`), the product
itself is `metadata.component` with the `bom-ref` `pkg:generic/<target name>`,
and the known vulnerabilities are listed at the top level, each naming the
components it affects. Licenses are an SPDX id, an SPDX expression or a named
license, as CycloneDX allows.
## VEX: the status of each vulnerability
For each known vulnerability (CVE alert) of a target you state whether the
product is affected (VEX, *Vulnerability Exploitability eXchange*), as the CRA
expects of a manufacturer handling vulnerabilities:
| Status | Meaning | Required |
|---|---|---|
| `under_investigation` | Not assessed yet; every alert starts here | -- |
| `affected` | The product is affected | an action statement: what users must do |
| `not_affected` | The product is not affected | a justification or an impact statement |
| `fixed` | The product no longer contains the vulnerable component or version | -- |
Justifications for `not_affected` (OpenVEX): `component_not_present`,
`vulnerable_code_not_present`, `vulnerable_code_not_in_execute_path`,
`vulnerable_code_cannot_be_controlled_by_adversary`,
`inline_mitigations_already_exist`. A statement without what its status
requires is refused.
A scan keeps the status current: when a complete CVE check no longer finds an
alert (the component was removed or updated past the fix), it is marked
resolved, and one nobody assessed, or assessed as affected, becomes `fixed`.
A `not_affected` or `fixed` someone stated is never changed by a scan. If the
vulnerability comes back, the scan's `fixed` is withdrawn.
The statements are exported per target as **OpenVEX 0.2.0** and as
**CycloneDX 1.5 VEX** (the SBOM with each vulnerability's analysis), both
checked against their official schemas, and are part of the evidence pack
(`vex.openvex.json`, `vex.cdx.json`). CycloneDX names the statuses
differently:
| OpenVEX | CycloneDX `analysis.state` / `justification` |
|---|---|
| `under_investigation` | `in_triage` |
| `affected` | `exploitable` (`response: update` when a fixed version is known) |
| `not_affected` | `not_affected` |
| `fixed` | `resolved` |
| `component_not_present`, `vulnerable_code_not_present` | `code_not_present` |
| `vulnerable_code_not_in_execute_path` | `code_not_reachable` |
| `vulnerable_code_cannot_be_controlled_by_adversary` | `requires_environment` |
| `inline_mitigations_already_exist` | `protected_by_mitigating_control` |
API: `GET /api/v1/targets/{id}/cves` lists the alerts with their statements,
`PATCH /api/v1/cves/{id}/vex` sets one
(`{"status": "not_affected", "justification": "…", "impact_statement": "…"}`),
`GET /api/v1/targets/{id}/vex?format=openvex|cyclonedx` downloads the document.
## Compare Tab
**Vergleich** compares the SBOMs of two targets, for example two firmware