not_affected needs a justification or an impact statement (OpenVEX);
affected needs an action statement (stricter than OpenVEX, as CISA recommends).
CveAlert gains vex and resolved_at. Both are skipped when empty, so the scan's $set upsert never wipes a statement. The hunk sits next to #500's exploitation.
Lifecycle (pipeline::vex_lifecycle)
Until now alerts were never resolved: a CVE whose component was removed stayed as it was.
Reported again → open; a fixed the scan had stated is withdrawn.
Gone after a complete lookup → resolved_at. Then:
unassessed or affected → fixed (by_scan);
a person's not_affected/fixed is never touched.
An incomplete lookup changes nothing.
API
GET /api/v1/targets/{id}/cves: alerts with their statements.
PATCH /api/v1/cves/{id}/vex: {status, justification?, impact_statement?, action_statement?}. Returns 422 with the reason when incomplete. It goes through the role gate and the support audit like every write.
GET /api/v1/targets/{id}/vex?format=openvex|cyclonedx: download.
Documents (compliance_core::vex_docs)
OpenVEX 0.2.0: one statement per alert. The product is pkg:generic/<target>, with the component (its purl) as a subcomponent.
CycloneDX 1.5 VEX: the SBOM plus every alert as a vulnerability with analysis. The state/justification mapping is documented in the module and in the guide (in_triage/exploitable/not_affected/resolved; code_not_present, code_not_reachable, requires_environment, protected_by_mitigating_control).
Evidence pack:vex.openvex.json, vex.cdx.json.
SBOM fix (CycloneDX was invalid)
sbom_docs used to put vulnerabilitiesinside components, which CycloneDX 1.5 forbids (components have additionalProperties: false).
Now:
vulnerabilities are top-level, with affects[].ref;
every component and the product have a bom-ref;
there's a serialNumber and metadata.timestamp/tools;
licences are an SPDX id (checked against CycloneDX's own SPDX list), an expression, or a name.
This changes the SBOM export, the evidence pack and the MCP get_sbom output for the better.
Part 1 of 4 for #498 (VEX and CSAF for CRA vulnerability handling). The split was agreed with the platform session. Stage only.
**Parts:** 1 = VEX state, API, OpenVEX/CycloneDX exports (this PR) · 2 = dashboard · 3 = CSAF 2.0 draft · 4 = ENISA report drafts.
## Model
- **`compliance_core::models::vex`:**
- `VexStatus`: `under_investigation`, `affected`, `not_affected`, `fixed`;
- the five OpenVEX justifications;
- `VexAssessment`: statement, who, when, `by_scan`.
- **`validate()`:**
- `not_affected` needs a justification or an impact statement (OpenVEX);
- `affected` needs an action statement (stricter than OpenVEX, as CISA recommends).
- **`CveAlert` gains `vex` and `resolved_at`.** Both are skipped when empty, so the scan's `$set` upsert never wipes a statement. The hunk sits next to #500's `exploitation`.
## Lifecycle (`pipeline::vex_lifecycle`)
Until now alerts were never resolved: a CVE whose component was removed stayed as it was.
- **Reported again** → open; a `fixed` the scan had stated is withdrawn.
- **Gone after a complete lookup** → `resolved_at`. Then:
- unassessed or `affected` → `fixed` (`by_scan`);
- a person's `not_affected`/`fixed` is never touched.
- **An incomplete lookup** changes nothing.
## API
- `GET /api/v1/targets/{id}/cves`: alerts with their statements.
- `PATCH /api/v1/cves/{id}/vex`: `{status, justification?, impact_statement?, action_statement?}`. Returns 422 with the reason when incomplete. It goes through the role gate and the support audit like every write.
- `GET /api/v1/targets/{id}/vex?format=openvex|cyclonedx`: download.
## Documents (`compliance_core::vex_docs`)
- **OpenVEX 0.2.0:** one statement per alert. The product is `pkg:generic/<target>`, with the component (its purl) as a subcomponent.
- **CycloneDX 1.5 VEX:** the SBOM plus every alert as a vulnerability with `analysis`. The state/justification mapping is documented in the module and in the guide (`in_triage`/`exploitable`/`not_affected`/`resolved`; `code_not_present`, `code_not_reachable`, `requires_environment`, `protected_by_mitigating_control`).
- **Evidence pack:** `vex.openvex.json`, `vex.cdx.json`.
## SBOM fix (CycloneDX was invalid)
- `sbom_docs` used to put `vulnerabilities` **inside components**, which CycloneDX 1.5 forbids (components have `additionalProperties: false`).
- Now:
- vulnerabilities are top-level, with `affects[].ref`;
- every component and the product have a `bom-ref`;
- there's a `serialNumber` and `metadata.timestamp/tools`;
- licences are an SPDX id (checked against CycloneDX's own SPDX list), an expression, or a name.
- This changes the SBOM export, the evidence pack and the MCP `get_sbom` output for the better.
## Vendored schemas (`compliance-core/schemas`, provenance README)
CycloneDX 1.5 + SPDX + JSF (Apache-2.0), OpenVEX 0.2.0 (CC0).
## Tests
- **Official schemas** (`jsonschema`, dev-only):
- the SBOM, OpenVEX and CycloneDX VEX validate;
- **negative controls** fail as they should: nested vulnerabilities, a licence name as an SPDX id, a statement without status.
- `validate()` rules.
- **Mongo (`tests/vex_lifecycle.rs`):**
- the scan fixes unassessed and affected alerts;
- it keeps a person's `not_affected`;
- it withdraws its own `fixed` when the CVE returns;
- an incomplete lookup does nothing.
- fmt and clippy `-D warnings`: core, agent, mcp, dashboard. Targeted tests locally per the RAM rule; CI runs the suite.
## To check on stage
Check 21 in the test plan:
- the 422 rules;
- stored statements;
- both downloads validate;
- the pack holds the two VEX files;
- updating log4j resolves and fixes its alert.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part 1 of 4 for #498 (VEX and CSAF for CRA vulnerability handling). The split was agreed with the platform session. Stage only.
Parts: 1 = VEX state, API, OpenVEX/CycloneDX exports (this PR) · 2 = dashboard · 3 = CSAF 2.0 draft · 4 = ENISA report drafts.
Model
compliance_core::models::vex:VexStatus:under_investigation,affected,not_affected,fixed;VexAssessment: statement, who, when,by_scan.validate():not_affectedneeds a justification or an impact statement (OpenVEX);affectedneeds an action statement (stricter than OpenVEX, as CISA recommends).CveAlertgainsvexandresolved_at. Both are skipped when empty, so the scan's$setupsert never wipes a statement. The hunk sits next to #500'sexploitation.Lifecycle (
pipeline::vex_lifecycle)Until now alerts were never resolved: a CVE whose component was removed stayed as it was.
fixedthe scan had stated is withdrawn.resolved_at. Then:affected→fixed(by_scan);not_affected/fixedis never touched.API
GET /api/v1/targets/{id}/cves: alerts with their statements.PATCH /api/v1/cves/{id}/vex:{status, justification?, impact_statement?, action_statement?}. Returns 422 with the reason when incomplete. It goes through the role gate and the support audit like every write.GET /api/v1/targets/{id}/vex?format=openvex|cyclonedx: download.Documents (
compliance_core::vex_docs)pkg:generic/<target>, with the component (its purl) as a subcomponent.analysis. The state/justification mapping is documented in the module and in the guide (in_triage/exploitable/not_affected/resolved;code_not_present,code_not_reachable,requires_environment,protected_by_mitigating_control).vex.openvex.json,vex.cdx.json.SBOM fix (CycloneDX was invalid)
sbom_docsused to putvulnerabilitiesinside components, which CycloneDX 1.5 forbids (components haveadditionalProperties: false).affects[].ref;bom-ref;serialNumberandmetadata.timestamp/tools;get_sbomoutput for the better.Vendored schemas (
compliance-core/schemas, provenance README)CycloneDX 1.5 + SPDX + JSF (Apache-2.0), OpenVEX 0.2.0 (CC0).
Tests
jsonschema, dev-only):validate()rules.tests/vex_lifecycle.rs):not_affected;fixedwhen the CVE returns;-D warnings: core, agent, mcp, dashboard. Targeted tests locally per the RAM rule; CI runs the suite.To check on stage
Check 21 in the test plan:
🤖 Generated with Claude Code
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
a5b312c8b2to058266e5ac