Demonstration plan, phase D3: on staging `BREAKPILOT_BASE_URL` points at `api-dev.breakpilot.ai`, which answers 401 until the dsms migration (M-MIG-9, parked). Control mapping was gated on that URL, so demo scans produce findings with **no control references** — the one thing a CRA prospect looks for. The catalog loader already snapshotted the bytes it fetched and fell back to them when the backend was down. This promotes the snapshot to a real source: - `OscalControlsProvider` takes `Option<String>` for the base URL; with `None` it serves snapshots only, and `has_snapshots()` decides whether control triage runs at all. - The agent image ships `compliance-agent/controls/snapshot/oscal-catalog-cra.json` — CRA Annex I, 8 groups / 40 controls, generated by breakpilot-compliance's own `build_cra_catalog()`, so it is byte-identical to what `?framework=cra` serves. The entrypoint copies it into `BREAKPILOT_SNAPSHOT_DIR` only if that file is absent, so a snapshot fetched from a live backend (or a mounted volume) always wins. - `scripts/refresh-oscal-snapshot.sh` regenerates the committed snapshots from a backend when one is reachable. - A test asserts the shipped file parses and still carries 40 controls, so a bad refresh cannot silently disable mapping. `master-controls` is DB-derived (~3k controls) and is not shipped, so the semantic pass stays a no-op offline; staging should set `BREAKPILOT_SEMANTIC_MAPPING=false` and drop `BREAKPILOT_BASE_URL` (separate orca-platform change). Deterministic LUT triage and the grounded surface checks then run against the CRA catalog and findings carry `control_refs`. Verified locally: `cargo fmt --all --check`, `cargo clippy -p compliance-agent -- -D warnings`, `cargo test -p compliance-agent --lib` (314 passed). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Reviewed-on: #250
35 lines
1.4 KiB
Bash
35 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
# Seed the nix store on first start, then run the agent.
|
|
#
|
|
# The firmware-SBOM pipeline drives a real `nix` build (tramiton NixBackend).
|
|
# The image ships the store as a bootstrap tarball rather than baking /nix, so a
|
|
# persistent /nix volume (mounted empty on first deploy) gets populated once and
|
|
# then survives redeploys. Seeding is best-effort: if it fails, the agent still
|
|
# starts and firmware SBOMs fall back to analysis-only.
|
|
if [ ! -e /nix/store ]; then
|
|
echo "agent-entrypoint: seeding /nix store from image bootstrap..."
|
|
mkdir -p /nix
|
|
if tar -C / -xzf /opt/nix-bootstrap.tar.gz; then
|
|
echo "agent-entrypoint: /nix store seeded."
|
|
else
|
|
echo "agent-entrypoint: WARN nix seed failed; firmware SBOM will use analysis-only fallback."
|
|
fi
|
|
fi
|
|
|
|
# Seed the OSCAL control-catalog snapshot. The image ships a catalog snapshot so
|
|
# control mapping works without the breakpilot-compliance backend
|
|
# (BREAKPILOT_BASE_URL unset). Copy-if-absent, so a snapshot refreshed from a
|
|
# live backend (or a mounted volume) always wins.
|
|
SNAP_DIR="${BREAKPILOT_SNAPSHOT_DIR:-/data/compliance-scanner/oscal}"
|
|
if [ -d /opt/breakpilot/oscal-snapshot ]; then
|
|
mkdir -p "$SNAP_DIR"
|
|
for f in /opt/breakpilot/oscal-snapshot/*.json; do
|
|
[ -e "$f" ] || continue
|
|
if [ ! -e "$SNAP_DIR/$(basename "$f")" ]; then
|
|
cp "$f" "$SNAP_DIR/" && echo "agent-entrypoint: seeded $(basename "$f") into $SNAP_DIR"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
exec compliance-agent "$@"
|