feat(controls): ship a CRA catalog snapshot, map without the backend
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) Successful in 5m55s

Control mapping was gated on BREAKPILOT_BASE_URL, so on staging (where
breakpilot-compliance is not reachable until the dsms migration) every
finding came back without control_refs. The catalog loader already
snapshots fetched bytes and falls back to them offline; this makes the
snapshot a first-class source:

- the provider takes an optional base URL and serves snapshots alone,
- the agent image ships compliance-agent/controls/snapshot (CRA Annex I,
  40 controls, built by breakpilot-compliance's build_cra_catalog) and
  the entrypoint seeds it into BREAKPILOT_SNAPSHOT_DIR if absent, so a
  snapshot refreshed from a live backend always wins,
- scripts/refresh-oscal-snapshot.sh regenerates the committed files.

master-controls stays DB-derived and unshipped, so the semantic pass is
still a no-op offline; run those environments with
BREAKPILOT_SEMANTIC_MAPPING=false.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
This commit is contained in:
Sharang ParnerkarandClaude Opus 5 committed 2026-09-12 20:20:04 +02:00
1 parent 7eb4d8054a
commit 3c8de961aa
9 files changed
+2935 -41

No files matched your search

+9 -3
View File
@@ -49,7 +49,7 @@ All three paths converge on the same **grounded judge** and the same **grounding
### Stage 5b — deterministic LUT triage
The default path. A tool finding is matched to controls via `control_map.controls_for_finding(tool, cwe, rule_id)`; the judge then confirms each mapped control against the code region. Outcomes: `Confirmed([ids])` (stamp them), `FalsePositive` (drop the finding), or `Unmapped` (keep it untagged). Runs whenever `BREAKPILOT_BASE_URL` is set.
The default path. A tool finding is matched to controls via `control_map.controls_for_finding(tool, cwe, rule_id)`; the judge then confirms each mapped control against the code region. Outcomes: `Confirmed([ids])` (stamp them), `FalsePositive` (drop the finding), or `Unmapped` (keep it untagged). Runs whenever a catalog is available — either `BREAKPILOT_BASE_URL` points at a breakpilot-compliance backend, or a catalog snapshot is present (see [snapshot-only mode](#snapshot-only-mode)).
### Stage 5c — semantic retrieval (master-controls scale)
@@ -121,12 +121,18 @@ Findings don't just land in the dashboard; they flow to breakpilot-compliance as
| Variable | Effect |
| --- | --- |
| `BREAKPILOT_BASE_URL` | breakpilot-compliance root; enables control ingest + all mapping passes. **Unset disables all control mapping** — findings are produced without `control_refs`. |
| `BREAKPILOT_BASE_URL` | breakpilot-compliance root; enables live control ingest. **Unset** falls back to the catalog snapshots in `BREAKPILOT_SNAPSHOT_DIR`; with neither, control mapping is off and findings carry no `control_refs`. |
| `BREAKPILOT_SEMANTIC_MAPPING` | Stage 5c (semantic master-controls mapping). **Default on** (validated live). |
| `BREAKPILOT_GROUNDED_CHECKS` | Stage 5d (grounded surface checks). **Default on** (validated live). |
| `BREAKPILOT_SNAPSHOT_DIR` | Where OSCAL catalog snapshots and the cached control-embedding index live. |
The semantic and grounded passes default **on** now that both are validated live; each is still a no-op if `BREAKPILOT_BASE_URL` is unset or the catalog is unreachable, so they only ever add coverage. The live verifications live in `compliance-agent/tests/c5_semantic_live.rs` and `grounded_surface_live.rs` (ignored; run with `--ignored`).
The semantic and grounded passes default **on** now that both are validated live; each is still a no-op if no catalog is reachable, so they only ever add coverage.
### Snapshot-only mode
The catalog loader already snapshots the exact bytes it fetches (`oscal-catalog-<framework>.json` under `BREAKPILOT_SNAPSHOT_DIR`) and falls back to that snapshot when the backend is unreachable. Snapshot-only mode is the same path without ever having been online: the agent image ships `compliance-agent/controls/snapshot/oscal-catalog-cra.json` (CRA Annex I, 40 controls, built by breakpilot-compliance's `build_cra_catalog`), and the entrypoint copies it into `BREAKPILOT_SNAPSHOT_DIR` if no file of that name is there yet. With `BREAKPILOT_BASE_URL` unset the deterministic LUT triage (5b) and the grounded surface checks (5d) therefore run and findings carry CRA `control_refs`, while the semantic pass (5c) stays a no-op because `master-controls` is DB-derived and is not shipped — set `BREAKPILOT_SEMANTIC_MAPPING=false` in that environment to skip its warning.
Refresh the committed snapshot from a live backend with `scripts/refresh-oscal-snapshot.sh` (see its header); a fetched snapshot always wins over the baked one, because the entrypoint only copies what is absent. The live verifications live in `compliance-agent/tests/c5_semantic_live.rs` and `grounded_surface_live.rs` (ignored; run with `--ignored`).
## Appendix — the master-controls data pipeline