From 3c8de961aa376c7fb4706bcb0734af2a5a798e60 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Sat, 12 Sep 2026 20:20:04 +0200 Subject: [PATCH] feat(controls): ship a CRA catalog snapshot, map without the backend 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 Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB --- .env.example | 11 + Dockerfile.agent | 4 + .../controls/snapshot/oscal-catalog-cra.json | 2765 +++++++++++++++++ .../src/controls/oscal_provider.rs | 88 +- compliance-agent/src/controls/scan_triage.rs | 42 +- compliance-agent/tests/c5_semantic_live.rs | 2 +- docker/agent-entrypoint.sh | 15 + docs/features/control-mapping.md | 12 +- scripts/refresh-oscal-snapshot.sh | 37 + 9 files changed, 2935 insertions(+), 41 deletions(-) create mode 100644 compliance-agent/controls/snapshot/oscal-catalog-cra.json create mode 100755 scripts/refresh-oscal-snapshot.sh diff --git a/.env.example b/.env.example index 0d54e8a..29f45bb 100644 --- a/.env.example +++ b/.env.example @@ -87,6 +87,17 @@ KEYCLOAK_CLIENT_ID=compliance-dashboard REDIRECT_URI=http://localhost:8080/auth/callback APP_URL=http://localhost:8080 +# Control mapping (OSCAL catalog from breakpilot-compliance) +# Unset BREAKPILOT_BASE_URL to run snapshot-only: the image ships a CRA catalog +# snapshot, so findings still carry control_refs without the backend. The +# master-controls catalog is DB-derived and not shipped — turn the semantic pass +# off when running snapshot-only. +# BREAKPILOT_BASE_URL=https://api-dev.breakpilot.ai +# BREAKPILOT_TOKEN= +BREAKPILOT_SNAPSHOT_DIR=/data/compliance-scanner/oscal +# BREAKPILOT_SEMANTIC_MAPPING=false +# BREAKPILOT_GROUNDED_CHECKS=true + # OpenTelemetry (optional - omit to disable) # OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 # OTEL_SERVICE_NAME=compliance-agent diff --git a/Dockerfile.agent b/Dockerfile.agent index 3f8add8..756719e 100644 --- a/Dockerfile.agent +++ b/Dockerfile.agent @@ -69,6 +69,10 @@ RUN mkdir -p /etc/nix && printf '%s\n' \ COPY --from=builder /app/target/release/compliance-agent /usr/local/bin/compliance-agent COPY docker/agent-entrypoint.sh /usr/local/bin/agent-entrypoint.sh +# OSCAL control-catalog snapshot: lets control mapping run without the +# breakpilot-compliance backend. The entrypoint seeds it into +# BREAKPILOT_SNAPSHOT_DIR on start (copy-if-absent). +COPY --from=builder /app/compliance-agent/controls/snapshot /opt/breakpilot/oscal-snapshot RUN chmod +x /usr/local/bin/agent-entrypoint.sh # Copy documentation for the help chat assistant diff --git a/compliance-agent/controls/snapshot/oscal-catalog-cra.json b/compliance-agent/controls/snapshot/oscal-catalog-cra.json new file mode 100644 index 0000000..e603caa --- /dev/null +++ b/compliance-agent/controls/snapshot/oscal-catalog-cra.json @@ -0,0 +1,2765 @@ +{ + "catalog": { + "uuid": "5bceade2-3b8b-5c7a-a959-5c2245d21ca9", + "metadata": { + "title": "EU Cyber Resilience Act — Annex I Essential Cybersecurity Requirements", + "last-modified": "2026-07-20T00:00:00+00:00", + "version": "1.0.0", + "oscal-version": "1.1.2", + "props": [ + { + "name": "framework", + "value": "cra", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "content-hash", + "value": "d093358ce572fd9868698c633be10173ad28e8c1dd4a35c2e9e4e87ecd3201c4", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "control-count", + "value": "40", + "ns": "https://breakpilot.ai/ns/oscal" + } + ] + }, + "groups": [ + { + "id": "cra-secure-by-design", + "class": "cra-category", + "title": "Secure-by-Design", + "controls": [ + { + "id": "cra-ai-1", + "class": "cra-annex-i", + "title": "Secure-by-Default-Konfiguration", + "props": [ + { + "name": "label", + "value": "CRA-AI-1" + }, + { + "name": "sort-id", + "value": "cra-ai-0001" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "hybrid", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(1)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Secure-by-Design", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "5", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.9", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-1_smt", + "name": "statement", + "prose": "Produkte muessen mit sicheren Standardeinstellungen ausgeliefert werden. Keine offenen Ports, keine aktivierten Debug-Schnittstellen, keine unnoetig laufenden Dienste." + } + ], + "links": [ + { + "href": "#14abd9ee-f7d1-51d6-a82d-689bc7d5f772", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-2", + "class": "cra-annex-i", + "title": "Minimale Angriffsflaeche", + "props": [ + { + "name": "label", + "value": "CRA-AI-2" + }, + { + "name": "sort-id", + "value": "cra-ai-0002" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(2)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Secure-by-Design", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "4", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.9", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.20", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-2_smt", + "name": "statement", + "prose": "Nur notwendige Schnittstellen, Dienste und Protokolle aktivieren." + } + ], + "links": [ + { + "href": "#7e9734b8-a25b-5f55-8d20-323c4e2847b7", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-3", + "class": "cra-annex-i", + "title": "Sichere Systemarchitektur", + "props": [ + { + "name": "label", + "value": "CRA-AI-3" + }, + { + "name": "sort-id", + "value": "cra-ai-0003" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Secure-by-Design", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "10", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.27", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-3_smt", + "name": "statement", + "prose": "Sicherheitskritische Komponenten muessen isoliert werden (Sandboxing, Containerisierung, Privilege Separation)." + } + ], + "links": [ + { + "href": "#90b00c59-21c9-50fe-b07b-6a5167cf9498", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-4", + "class": "cra-annex-i", + "title": "Least-Privilege-Prinzip", + "props": [ + { + "name": "label", + "value": "CRA-AI-4" + }, + { + "name": "sort-id", + "value": "cra-ai-0004" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(d)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Secure-by-Design", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "5", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.2", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.3", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-4_smt", + "name": "statement", + "prose": "Jede Komponente, jeder Prozess und jeder Benutzer erhaelt nur die minimal notwendigen Berechtigungen." + } + ], + "links": [ + { + "href": "#d2417ab3-6e3d-5c3d-90d5-65a37b59038e", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-5", + "class": "cra-annex-i", + "title": "Manipulationsschutz", + "props": [ + { + "name": "label", + "value": "CRA-AI-5" + }, + { + "name": "sort-id", + "value": "cra-ai-0005" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(c)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Secure-by-Design", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "8", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.24", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-5_smt", + "name": "statement", + "prose": "Schutz vor unautorisierter Aenderung von Software und Konfiguration (Code Signing, Secure Boot, TPM)." + } + ], + "links": [ + { + "href": "#27c3027f-f409-589c-b71f-d9a5fc4da3f5", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-6", + "class": "cra-annex-i", + "title": "Integritaetspruefung", + "props": [ + { + "name": "label", + "value": "CRA-AI-6" + }, + { + "name": "sort-id", + "value": "cra-ai-0006" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(c)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Secure-by-Design", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "4", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.24", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-6_smt", + "name": "statement", + "prose": "Automatische Ueberpruefung der Integritaet von Software, Firmware und Konfigurationsdaten bei Start und Laufzeit." + } + ], + "links": [ + { + "href": "#10070107-67d5-5c8d-b735-62677e85a24d", + "rel": "reference" + } + ] + } + ] + }, + { + "id": "cra-authentifizierung", + "class": "cra-category", + "title": "Authentifizierung", + "controls": [ + { + "id": "cra-ai-7", + "class": "cra-annex-i", + "title": "Starke Authentifizierung", + "props": [ + { + "name": "label", + "value": "CRA-AI-7" + }, + { + "name": "sort-id", + "value": "cra-ai-0007" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(d)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Authentifizierung", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "6", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.5", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-7_smt", + "name": "statement", + "prose": "Sichere Authentifizierungsmechanismen, MFA fuer administrative Zugriffe, FIDO2/WebAuthn." + } + ], + "links": [ + { + "href": "#5bbe7860-2c3d-5ef9-9a8b-3f0cd3d785f4", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-8", + "class": "cra-annex-i", + "title": "Keine Default-Passwoerter", + "props": [ + { + "name": "label", + "value": "CRA-AI-8" + }, + { + "name": "sort-id", + "value": "cra-ai-0008" + }, + { + "name": "severity", + "value": "critical", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(d)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Authentifizierung", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "2", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.5", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-8_smt", + "name": "statement", + "prose": "Produkte duerfen keine universellen Standardpasswoerter verwenden. Aenderung bei Ersteinrichtung erzwingen." + } + ], + "links": [ + { + "href": "#d5eab715-2450-576d-bead-6d5ff8d3e7a3", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-9", + "class": "cra-annex-i", + "title": "Sicheres Credential-Management", + "props": [ + { + "name": "label", + "value": "CRA-AI-9" + }, + { + "name": "sort-id", + "value": "cra-ai-0009" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(d)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Authentifizierung", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "3", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.5", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-9_smt", + "name": "statement", + "prose": "Zugangsdaten verschluesselt speichern (bcrypt, Argon2id). Keine Klartextspeicherung. Tokens rotieren." + } + ], + "links": [ + { + "href": "#d5eab715-2450-576d-bead-6d5ff8d3e7a3", + "rel": "reference" + }, + { + "href": "#891e0a3a-f623-54f5-be4d-f315ea5570fe", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-10", + "class": "cra-annex-i", + "title": "Sitzungsmanagement", + "props": [ + { + "name": "label", + "value": "CRA-AI-10" + }, + { + "name": "sort-id", + "value": "cra-ai-0010" + }, + { + "name": "severity", + "value": "medium", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(d)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Authentifizierung", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "3", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.5", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-10_smt", + "name": "statement", + "prose": "Session-Verwaltung mit Timeout, Token-Binding, Invalidierung bei Logout. CSRF-Schutz." + } + ], + "links": [ + { + "href": "#02a48325-6895-506d-b712-ac83671cc157", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-11", + "class": "cra-annex-i", + "title": "Brute-Force-Schutz", + "props": [ + { + "name": "label", + "value": "CRA-AI-11" + }, + { + "name": "sort-id", + "value": "cra-ai-0011" + }, + { + "name": "severity", + "value": "medium", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(d)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Authentifizierung", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "2", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.5", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.16", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-11_smt", + "name": "statement", + "prose": "Schutz vor Brute-Force und Credential-Stuffing via Rate Limiting, Account Lockout, CAPTCHA." + } + ], + "links": [ + { + "href": "#a58e81bd-4a6a-5176-ade3-6957af0db534", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-12", + "class": "cra-annex-i", + "title": "Rollenbasierte Autorisierung", + "props": [ + { + "name": "label", + "value": "CRA-AI-12" + }, + { + "name": "sort-id", + "value": "cra-ai-0012" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(d)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Authentifizierung", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "4", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.2", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.3", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-12_smt", + "name": "statement", + "prose": "RBAC implementieren. Trennung administrativ vs Nutzer. Least-Privilege durchsetzen." + } + ], + "links": [ + { + "href": "#d2417ab3-6e3d-5c3d-90d5-65a37b59038e", + "rel": "reference" + } + ] + } + ] + }, + { + "id": "cra-kryptografie", + "class": "cra-category", + "title": "Kryptografie", + "controls": [ + { + "id": "cra-ai-13", + "class": "cra-annex-i", + "title": "Verschluesselung sensibler Daten", + "props": [ + { + "name": "label", + "value": "CRA-AI-13" + }, + { + "name": "sort-id", + "value": "cra-ai-0013" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(e)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Kryptografie", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "4", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.24", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-13_smt", + "name": "statement", + "prose": "Sensible Daten at rest (AES-256) und in transit (TLS 1.2+) verschluesseln." + } + ], + "links": [ + { + "href": "#f62d92ba-188d-5718-8df9-f101758c5ed7", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-14", + "class": "cra-annex-i", + "title": "Speicher-Schutz (Data at Rest)", + "props": [ + { + "name": "label", + "value": "CRA-AI-14" + }, + { + "name": "sort-id", + "value": "cra-ai-0014" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(e)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Kryptografie", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "3", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.24", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-14_smt", + "name": "statement", + "prose": "Verschluesselung von Festplatten, Datenbanken, Backups. Schluessel getrennt von Daten." + } + ], + "links": [ + { + "href": "#f62d92ba-188d-5718-8df9-f101758c5ed7", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-15", + "class": "cra-annex-i", + "title": "Transport-Schutz (Data in Transit)", + "props": [ + { + "name": "label", + "value": "CRA-AI-15" + }, + { + "name": "sort-id", + "value": "cra-ai-0015" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(e)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Kryptografie", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "2", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.24", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-15_smt", + "name": "statement", + "prose": "TLS 1.2+ fuer alle Netzwerkkommunikation. SSL/TLS 1.0/1.1 deaktivieren. Certificate Pinning." + } + ], + "links": [ + { + "href": "#903ec471-c64a-51e1-8d42-55ad0cfee74d", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-16", + "class": "cra-annex-i", + "title": "Sicheres Schluesselmanagement", + "props": [ + { + "name": "label", + "value": "CRA-AI-16" + }, + { + "name": "sort-id", + "value": "cra-ai-0016" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "hybrid", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(e)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Kryptografie", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "8", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.24", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-16_smt", + "name": "statement", + "prose": "Schluessel in HSM/Vault. Mind. jaehrliche Rotation. Dokumentation der Lebenszyklen." + } + ], + "links": [ + { + "href": "#891e0a3a-f623-54f5-be4d-f315ea5570fe", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-17", + "class": "cra-annex-i", + "title": "Datenminimierung", + "props": [ + { + "name": "label", + "value": "CRA-AI-17" + }, + { + "name": "sort-id", + "value": "cra-ai-0017" + }, + { + "name": "severity", + "value": "medium", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "process", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(f)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Kryptografie", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "3", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.10", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.11", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-17_smt", + "name": "statement", + "prose": "Nur Daten erfassen, die fuer die Produktfunktion erforderlich sind. DSGVO-Grundsaetze beachten." + } + ], + "links": [ + { + "href": "#bd8cbb1d-4236-5919-b6b7-72a7fc93c672", + "rel": "reference" + } + ] + } + ] + }, + { + "id": "cra-ssdlc", + "class": "cra-category", + "title": "SSDLC", + "controls": [ + { + "id": "cra-ai-18", + "class": "cra-annex-i", + "title": "Strukturierter SSDLC", + "props": [ + { + "name": "label", + "value": "CRA-AI-18" + }, + { + "name": "sort-id", + "value": "cra-ai-0018" + }, + { + "name": "severity", + "value": "medium", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "process", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(1)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "SSDLC", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "15", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.25", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.26", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-18_smt", + "name": "statement", + "prose": "Formaler Secure Software Development Lifecycle mit Security Gates in jeder Phase." + } + ], + "links": [ + { + "href": "#7c7074aa-d4e0-5839-b790-f85666d3cf60", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-19", + "class": "cra-annex-i", + "title": "Systematische Code Reviews", + "props": [ + { + "name": "label", + "value": "CRA-AI-19" + }, + { + "name": "sort-id", + "value": "cra-ai-0019" + }, + { + "name": "severity", + "value": "medium", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "process", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(1)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "SSDLC", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "5", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.25", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-19_smt", + "name": "statement", + "prose": "Peer Reviews mit Security-Fokus fuer jeden Commit. OWASP Top 10 + CWE Top 25 Checklisten." + } + ], + "links": [ + { + "href": "#7c7074aa-d4e0-5839-b790-f85666d3cf60", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-20", + "class": "cra-annex-i", + "title": "Automatisierte Sicherheitstests", + "props": [ + { + "name": "label", + "value": "CRA-AI-20" + }, + { + "name": "sort-id", + "value": "cra-ai-0020" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(1)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "SSDLC", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "8", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.25", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-20_smt", + "name": "statement", + "prose": "SAST, DAST, SCA und Secrets Detection in der CI/CD-Pipeline." + } + ], + "links": [ + { + "href": "#6176460f-c8e2-5699-9d51-7e18a47923c6", + "rel": "reference" + } + ] + } + ] + }, + { + "id": "cra-supply-chain", + "class": "cra-category", + "title": "Supply Chain", + "controls": [ + { + "id": "cra-ai-21", + "class": "cra-annex-i", + "title": "Supply-Chain-Security", + "props": [ + { + "name": "label", + "value": "CRA-AI-21" + }, + { + "name": "sort-id", + "value": "cra-ai-0021" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "process", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(5)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Supply Chain", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "5", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.5.19", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.5.21", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-21_smt", + "name": "statement", + "prose": "Drittanbieter-Komponenten systematisch auf Schwachstellen und Lizenz-Compliance pruefen." + } + ], + "links": [ + { + "href": "#701f74a5-16be-59e7-b24f-fe0385b4654a", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-22", + "class": "cra-annex-i", + "title": "Dependency-Monitoring", + "props": [ + { + "name": "label", + "value": "CRA-AI-22" + }, + { + "name": "sort-id", + "value": "cra-ai-0022" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(5)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Supply Chain", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "3", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.8", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.25", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-22_smt", + "name": "statement", + "prose": "Kontinuierliche CVE-Ueberwachung aller Abhaengigkeiten. Automatische Benachrichtigungen." + } + ], + "links": [ + { + "href": "#d0a1e513-e068-55ac-bce8-092189b8bf80", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-23", + "class": "cra-annex-i", + "title": "Software Bill of Materials (SBOM)", + "props": [ + { + "name": "label", + "value": "CRA-AI-23" + }, + { + "name": "sort-id", + "value": "cra-ai-0023" + }, + { + "name": "severity", + "value": "critical", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(5)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Supply Chain", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "2", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.25", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-23_smt", + "name": "statement", + "prose": "Maschinenlesbares SBOM (CycloneDX oder SPDX). Top-Level-Abhaengigkeiten mit Name, Version, Lizenz. Bei jedem Release aktualisieren." + } + ], + "links": [ + { + "href": "#324d56b6-d2bd-58b4-b601-38f1e8d37ac0", + "rel": "reference" + } + ] + } + ] + }, + { + "id": "cra-logging", + "class": "cra-category", + "title": "Logging", + "controls": [ + { + "id": "cra-ai-24", + "class": "cra-annex-i", + "title": "Security-Logging", + "props": [ + { + "name": "label", + "value": "CRA-AI-24" + }, + { + "name": "sort-id", + "value": "cra-ai-0024" + }, + { + "name": "severity", + "value": "medium", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(g)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Logging", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "4", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.15", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-24_smt", + "name": "statement", + "prose": "Logs aller sicherheitsrelevanten Ereignisse: Login, Berechtigungen, Admin-Aktionen, APIs, Fehler." + } + ], + "links": [ + { + "href": "#a58e81bd-4a6a-5176-ade3-6957af0db534", + "rel": "reference" + }, + { + "href": "#cea5c4a7-72a0-5a3a-9fb1-823e275df1a9", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-25", + "class": "cra-annex-i", + "title": "Ereignis-Monitoring", + "props": [ + { + "name": "label", + "value": "CRA-AI-25" + }, + { + "name": "sort-id", + "value": "cra-ai-0025" + }, + { + "name": "severity", + "value": "medium", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "process", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(g)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Logging", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "10", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.16", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-25_smt", + "name": "statement", + "prose": "Zentrale Sammlung und Echtzeit-Ueberwachung. SIEM oder vergleichbares. Event-Korrelation." + } + ], + "links": [ + { + "href": "#cea5c4a7-72a0-5a3a-9fb1-823e275df1a9", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-26", + "class": "cra-annex-i", + "title": "Anomalie-Erkennung", + "props": [ + { + "name": "label", + "value": "CRA-AI-26" + }, + { + "name": "sort-id", + "value": "cra-ai-0026" + }, + { + "name": "severity", + "value": "medium", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "process", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(g)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Logging", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "8", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.16", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-26_smt", + "name": "statement", + "prose": "Automatische Erkennung von Angriffsmustern. Alarmierung bei Baseline-Abweichungen. Threat Intel." + } + ], + "links": [ + { + "href": "#cea5c4a7-72a0-5a3a-9fb1-823e275df1a9", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-27", + "class": "cra-annex-i", + "title": "Log-Integritaet und -Aufbewahrung", + "props": [ + { + "name": "label", + "value": "CRA-AI-27" + }, + { + "name": "sort-id", + "value": "cra-ai-0027" + }, + { + "name": "severity", + "value": "medium", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(3)(g)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Logging", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "4", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.15", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-27_smt", + "name": "statement", + "prose": "Manipulationssichere Logs (append-only, signiert oder WORM). Mind. 12 Monate Aufbewahrung." + } + ], + "links": [ + { + "href": "#9682b9df-e3b4-560c-8b1d-3c20cac75b29", + "rel": "reference" + } + ] + } + ] + }, + { + "id": "cra-updates", + "class": "cra-category", + "title": "Updates", + "controls": [ + { + "id": "cra-ai-28", + "class": "cra-annex-i", + "title": "Sichere Update-Mechanismen", + "props": [ + { + "name": "label", + "value": "CRA-AI-28" + }, + { + "name": "sort-id", + "value": "cra-ai-0028" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(4)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Updates", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "8", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.8", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.19", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-28_smt", + "name": "statement", + "prose": "Updates ueber sichere Kanaele (HTTPS, signiert). Automatische oder einfach zugaengliche Update-Moeglichkeit. Rollback-Faehigkeit." + } + ], + "links": [ + { + "href": "#27c3027f-f409-589c-b71f-d9a5fc4da3f5", + "rel": "reference" + }, + { + "href": "#10070107-67d5-5c8d-b735-62677e85a24d", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-29", + "class": "cra-annex-i", + "title": "Update-Authentizitaet", + "props": [ + { + "name": "label", + "value": "CRA-AI-29" + }, + { + "name": "sort-id", + "value": "cra-ai-0029" + }, + { + "name": "severity", + "value": "critical", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(4)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Updates", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "3", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.24", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-29_smt", + "name": "statement", + "prose": "Updates digital signiert. Signaturpruefung vor Installation. Dokumentierte Key Ceremony." + } + ], + "links": [ + { + "href": "#27c3027f-f409-589c-b71f-d9a5fc4da3f5", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-30", + "class": "cra-annex-i", + "title": "Update-Integritaet", + "props": [ + { + "name": "label", + "value": "CRA-AI-30" + }, + { + "name": "sort-id", + "value": "cra-ai-0030" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(4)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Updates", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "2", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.24", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-30_smt", + "name": "statement", + "prose": "Integritaetspruefung jedes Update-Pakets (Hash, Signatur). Manipulationen waehrend Uebertragung erkennen." + } + ], + "links": [ + { + "href": "#10070107-67d5-5c8d-b735-62677e85a24d", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-31", + "class": "cra-annex-i", + "title": "Lifecycle-Support", + "props": [ + { + "name": "label", + "value": "CRA-AI-31" + }, + { + "name": "sort-id", + "value": "cra-ai-0031" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "process", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 1(4)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Updates", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "3", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.8", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-31_smt", + "name": "statement", + "prose": "Security-Updates fuer mind. 5 Jahre ab Inverkehrbringen oder erwartete Nutzungsdauer. End-of-Life klar kommunizieren." + } + ], + "links": [ + { + "href": "#33bdbdea-1435-5758-a20a-afbb8b6dff44", + "rel": "reference" + } + ] + } + ] + }, + { + "id": "cra-vulnerability-handling", + "class": "cra-category", + "title": "Vulnerability Handling", + "controls": [ + { + "id": "cra-ai-32", + "class": "cra-annex-i", + "title": "Schwachstellen-Identifikation", + "props": [ + { + "name": "label", + "value": "CRA-AI-32" + }, + { + "name": "sort-id", + "value": "cra-ai-0032" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "process", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 2(1)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Vulnerability Handling", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "4", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.8", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-32_smt", + "name": "statement", + "prose": "Kontinuierliches CVE-Monitoring aller eingesetzten Komponenten. Bug Bounty oder Responsible Disclosure." + } + ], + "links": [ + { + "href": "#d0a1e513-e068-55ac-bce8-092189b8bf80", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-33", + "class": "cra-annex-i", + "title": "SBOM-Pflege und Analyse", + "props": [ + { + "name": "label", + "value": "CRA-AI-33" + }, + { + "name": "sort-id", + "value": "cra-ai-0033" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "code", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 2(1)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Vulnerability Handling", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "3", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.8", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.25", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-33_smt", + "name": "statement", + "prose": "SBOM aktuell halten und kontinuierlich gegen CVE-Datenbanken pruefen. Auto-Alarmierung bei neuen CVEs." + } + ], + "links": [ + { + "href": "#324d56b6-d2bd-58b4-b601-38f1e8d37ac0", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-34", + "class": "cra-annex-i", + "title": "Risikobasierte Priorisierung", + "props": [ + { + "name": "label", + "value": "CRA-AI-34" + }, + { + "name": "sort-id", + "value": "cra-ai-0034" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "process", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 2(2)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Vulnerability Handling", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "2", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.8", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-34_smt", + "name": "statement", + "prose": "CVSS-basierte Priorisierung. SLAs: Kritisch 24-72h, Hoch 7 Tage, Mittel 30 Tage, Niedrig naechster Zyklus." + } + ], + "links": [ + { + "href": "#33bdbdea-1435-5758-a20a-afbb8b6dff44", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-35", + "class": "cra-annex-i", + "title": "Coordinated Vulnerability Disclosure", + "props": [ + { + "name": "label", + "value": "CRA-AI-35" + }, + { + "name": "sort-id", + "value": "cra-ai-0035" + }, + { + "name": "severity", + "value": "critical", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "document", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 2(5)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Vulnerability Handling", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "2", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.5.5", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.5.6", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-35_smt", + "name": "statement", + "prose": "CVD-Policy mit Meldeprozess. Kontaktadresse fuer Forscher. Eingangsbestaetigung innerhalb 5 Werktagen." + } + ], + "links": [ + { + "href": "#fca99555-6c17-539e-aec8-26aa071c733b", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-36", + "class": "cra-annex-i", + "title": "Incident-Response-Prozess", + "props": [ + { + "name": "label", + "value": "CRA-AI-36" + }, + { + "name": "sort-id", + "value": "cra-ai-0036" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "process", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 2(5)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Vulnerability Handling", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "10", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.5.24", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.5.25", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.5.26", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-36_smt", + "name": "statement", + "prose": "Dokumentierter Prozess: Detection -> Classification -> Containment -> Investigation -> Recovery -> Reporting -> Lessons Learned." + } + ], + "links": [ + { + "href": "#b9bfabf1-bf87-5512-a69f-1e6f7cca06cd", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-37", + "class": "cra-annex-i", + "title": "Fruehwarnung (24h)", + "props": [ + { + "name": "label", + "value": "CRA-AI-37" + }, + { + "name": "sort-id", + "value": "cra-ai-0037" + }, + { + "name": "severity", + "value": "critical", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "process", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 2(7) + Art. 14(2)(a)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Vulnerability Handling", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "3", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.5.24", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.5.26", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-37_smt", + "name": "statement", + "prose": "Bei aktiv ausgenutzten Schwachstellen oder schweren Vorfaellen: Fruehwarnung an ENISA/CSIRT innerhalb 24 Stunden." + } + ], + "links": [ + { + "href": "#b9bfabf1-bf87-5512-a69f-1e6f7cca06cd", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-38", + "class": "cra-annex-i", + "title": "Detaillierter Vorfallsbericht (72h)", + "props": [ + { + "name": "label", + "value": "CRA-AI-38" + }, + { + "name": "sort-id", + "value": "cra-ai-0038" + }, + { + "name": "severity", + "value": "critical", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "process", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 2(7) + Art. 14(2)(b)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Vulnerability Handling", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "2", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.5.24", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.5.26", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-38_smt", + "name": "statement", + "prose": "72h: Detaillierter Bericht mit Umfang, Auswirkung, Ursachenanalyse, Gegenmassnahmen. Bei personenbezogenen Daten zusaetzlich DSGVO Art. 33/34." + } + ], + "links": [ + { + "href": "#b9bfabf1-bf87-5512-a69f-1e6f7cca06cd", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-39", + "class": "cra-annex-i", + "title": "Patch-Bereitstellung", + "props": [ + { + "name": "label", + "value": "CRA-AI-39" + }, + { + "name": "sort-id", + "value": "cra-ai-0039" + }, + { + "name": "severity", + "value": "high", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "process", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 2(3)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Vulnerability Handling", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "5", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.8.8", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-39_smt", + "name": "statement", + "prose": "Patches fuer gemeldete Schwachstellen so schnell wie moeglich. Security Advisories (CSAF-Format empfohlen)." + } + ], + "links": [ + { + "href": "#33bdbdea-1435-5758-a20a-afbb8b6dff44", + "rel": "reference" + } + ] + }, + { + "id": "cra-ai-40", + "class": "cra-annex-i", + "title": "Dokumentation und Nachbereitung", + "props": [ + { + "name": "label", + "value": "CRA-AI-40" + }, + { + "name": "sort-id", + "value": "cra-ai-0040" + }, + { + "name": "severity", + "value": "medium", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "evidence-type", + "value": "document", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "annex-anchor", + "value": "Annex I, 2(6)", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "category", + "value": "Vulnerability Handling", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "effort-days", + "value": "3", + "ns": "https://breakpilot.ai/ns/oscal" + }, + { + "name": "iso-27001", + "value": "A.5.27", + "ns": "https://breakpilot.ai/ns/oscal" + } + ], + "parts": [ + { + "id": "cra-ai-40_smt", + "name": "statement", + "prose": "Lueckenlose Dokumentation aller Schwachstellen + Vorfaelle, mind. 10 Jahre Aufbewahrung. Lessons-Learned-Prozess." + } + ], + "links": [ + { + "href": "#14abd9ee-f7d1-51d6-a82d-689bc7d5f772", + "rel": "reference" + }, + { + "href": "#9682b9df-e3b4-560c-8b1d-3c20cac75b29", + "rel": "reference" + } + ] + } + ] + } + ], + "back-matter": { + "resources": [ + { + "uuid": "14abd9ee-f7d1-51d6-a82d-689bc7d5f772", + "title": "M545", + "props": [ + { + "name": "label", + "value": "M545" + } + ], + "description": "Secure-by-Default-Konfiguration und Cybersecurity-Hardening-Guide beilegen" + }, + { + "uuid": "7e9734b8-a25b-5f55-8d20-323c4e2847b7", + "title": "M600", + "props": [ + { + "name": "label", + "value": "M600" + } + ], + "description": "Nicht benötigte Dienste, Ports und Protokolle standardmäßig deaktivieren" + }, + { + "uuid": "90b00c59-21c9-50fe-b07b-6a5167cf9498", + "title": "M601", + "props": [ + { + "name": "label", + "value": "M601" + } + ], + "description": "Sichere Systemarchitektur mit Netzwerkzonen und Conduits umsetzen" + }, + { + "uuid": "d2417ab3-6e3d-5c3d-90d5-65a37b59038e", + "title": "M602", + "props": [ + { + "name": "label", + "value": "M602" + } + ], + "description": "Least-Privilege und rollenbasierte Autorisierung erzwingen" + }, + { + "uuid": "27c3027f-f409-589c-b71f-d9a5fc4da3f5", + "title": "M541", + "props": [ + { + "name": "label", + "value": "M541" + } + ], + "description": "Signierte Software- und Firmware-Updates mit Rollback-Schutz" + }, + { + "uuid": "10070107-67d5-5c8d-b735-62677e85a24d", + "title": "M547", + "props": [ + { + "name": "label", + "value": "M547" + } + ], + "description": "Updates über authentisierten Kanal mit Integritätsprüfung" + }, + { + "uuid": "5bbe7860-2c3d-5ef9-9a8b-3f0cd3d785f4", + "title": "M603", + "props": [ + { + "name": "label", + "value": "M603" + } + ], + "description": "Starke Authentifizierung für privilegierte Zugänge einsetzen" + }, + { + "uuid": "d5eab715-2450-576d-bead-6d5ff8d3e7a3", + "title": "M542", + "props": [ + { + "name": "label", + "value": "M542" + } + ], + "description": "Initiale Default-Passwörter beim ersten Start erzwungen ändern" + }, + { + "uuid": "891e0a3a-f623-54f5-be4d-f315ea5570fe", + "title": "M604", + "props": [ + { + "name": "label", + "value": "M604" + } + ], + "description": "Credential- und Schlüsselmanagement etablieren" + }, + { + "uuid": "02a48325-6895-506d-b712-ac83671cc157", + "title": "M605", + "props": [ + { + "name": "label", + "value": "M605" + } + ], + "description": "Sitzungen automatisch absichern und beenden" + }, + { + "uuid": "a58e81bd-4a6a-5176-ade3-6957af0db534", + "title": "M606", + "props": [ + { + "name": "label", + "value": "M606" + } + ], + "description": "Brute-Force-Angriffe begrenzen und Anmeldungen protokollieren" + }, + { + "uuid": "f62d92ba-188d-5718-8df9-f101758c5ed7", + "title": "M607", + "props": [ + { + "name": "label", + "value": "M607" + } + ], + "description": "Vertrauliche Daten im Gerät und in Backups verschlüsseln" + }, + { + "uuid": "903ec471-c64a-51e1-8d42-55ad0cfee74d", + "title": "M608", + "props": [ + { + "name": "label", + "value": "M608" + } + ], + "description": "Externe Kommunikation kryptographisch absichern" + }, + { + "uuid": "bd8cbb1d-4236-5919-b6b7-72a7fc93c672", + "title": "M609", + "props": [ + { + "name": "label", + "value": "M609" + } + ], + "description": "Datenminimierung für Erhebung, Telemetrie und Logs umsetzen" + }, + { + "uuid": "7c7074aa-d4e0-5839-b790-f85666d3cf60", + "title": "M610", + "props": [ + { + "name": "label", + "value": "M610" + } + ], + "description": "Secure Software Development Lifecycle mit Code Reviews betreiben" + }, + { + "uuid": "6176460f-c8e2-5699-9d51-7e18a47923c6", + "title": "M548", + "props": [ + { + "name": "label", + "value": "M548" + } + ], + "description": "Sicherheitsbewertung / Penetrationstest vor Inverkehrbringen durchführen" + }, + { + "uuid": "701f74a5-16be-59e7-b24f-fe0385b4654a", + "title": "M612", + "props": [ + { + "name": "label", + "value": "M612" + } + ], + "description": "Supply-Chain-Security: Drittkomponenten vor Integration bewerten" + }, + { + "uuid": "d0a1e513-e068-55ac-bce8-092189b8bf80", + "title": "M611", + "props": [ + { + "name": "label", + "value": "M611" + } + ], + "description": "Schwachstellen identifizieren und Abhängigkeiten kontinuierlich überwachen" + }, + { + "uuid": "324d56b6-d2bd-58b4-b601-38f1e8d37ac0", + "title": "M540", + "props": [ + { + "name": "label", + "value": "M540" + } + ], + "description": "Software Bill of Materials (SBOM) erstellen und mitliefern" + }, + { + "uuid": "cea5c4a7-72a0-5a3a-9fb1-823e275df1a9", + "title": "M613", + "props": [ + { + "name": "label", + "value": "M613" + } + ], + "description": "Sicherheitsereignisse protokollieren, überwachen und auf Anomalien prüfen" + }, + { + "uuid": "9682b9df-e3b4-560c-8b1d-3c20cac75b29", + "title": "M614", + "props": [ + { + "name": "label", + "value": "M614" + } + ], + "description": "Log-Integrität, Aufbewahrung und Vorfalldokumentation sicherstellen" + }, + { + "uuid": "33bdbdea-1435-5758-a20a-afbb8b6dff44", + "title": "M544", + "props": [ + { + "name": "label", + "value": "M544" + } + ], + "description": "Patch-SLA mit Severity-Tiers dokumentieren und Lifecycle-Support festlegen" + }, + { + "uuid": "fca99555-6c17-539e-aec8-26aa071c733b", + "title": "M543", + "props": [ + { + "name": "label", + "value": "M543" + } + ], + "description": "Coordinated-Vulnerability-Disclosure-Policy veröffentlichen und betreiben" + }, + { + "uuid": "b9bfabf1-bf87-5512-a69f-1e6f7cca06cd", + "title": "M546", + "props": [ + { + "name": "label", + "value": "M546" + } + ], + "description": "Incident-Meldeprozess an ENISA / nationale CSIRT definieren" + } + ] + } + } +} diff --git a/compliance-agent/src/controls/oscal_provider.rs b/compliance-agent/src/controls/oscal_provider.rs index 84dfc8d..4777771 100644 --- a/compliance-agent/src/controls/oscal_provider.rs +++ b/compliance-agent/src/controls/oscal_provider.rs @@ -7,7 +7,7 @@ //! consumes. The producer owns the catalog; we own the assessment — this is the //! ingest half of the loop. -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use secrecy::{ExposeSecret, SecretString}; @@ -20,34 +20,53 @@ use compliance_core::traits::{Control, ControlQuery, ControlsProvider}; /// and snapshots it locally for deterministic / offline reuse. pub struct OscalControlsProvider { http: reqwest::Client, - base_url: String, + /// `None` = snapshot-only: no fetch, serve whatever is under `snapshot_dir` + /// (baked into the image or written by an earlier online run). + base_url: Option, token: Option, snapshot_dir: PathBuf, } impl OscalControlsProvider { /// Create a provider. `base_url` is the breakpilot-compliance root (e.g. - /// `http://backend-compliance:8002`); `snapshot_dir` is where catalog - /// snapshots are written so a later scan can reuse them without the network. + /// `http://backend-compliance:8002`) or `None` for snapshot-only mode; + /// `snapshot_dir` is where catalog snapshots are written so a later scan can + /// reuse them without the network. pub fn new( http: reqwest::Client, - base_url: impl Into, + base_url: Option, token: Option, snapshot_dir: impl Into, ) -> Self { Self { http, - base_url: base_url.into(), + base_url, token, snapshot_dir: snapshot_dir.into(), } } - fn catalog_url(&self, framework: &str) -> String { - format!( - "{}/api/compliance/v1/oscal/catalog?framework={framework}", - self.base_url.trim_end_matches('/') - ) + fn catalog_url(&self, framework: &str) -> Option { + self.base_url.as_deref().map(|b| { + format!( + "{}/api/compliance/v1/oscal/catalog?framework={framework}", + b.trim_end_matches('/') + ) + }) + } + + /// True when at least one `oscal-catalog-*.json` snapshot exists, i.e. the + /// provider can serve catalogs without a backend. + pub fn has_snapshots(snapshot_dir: &Path) -> bool { + std::fs::read_dir(snapshot_dir) + .map(|rd| { + rd.flatten().any(|e| { + let n = e.file_name(); + let n = n.to_string_lossy(); + n.starts_with("oscal-catalog-") && n.ends_with(".json") + }) + }) + .unwrap_or(false) } fn snapshot_path(&self, framework: &str) -> PathBuf { @@ -57,7 +76,12 @@ impl OscalControlsProvider { /// Fetch the raw catalog bytes for a framework token over HTTP. async fn fetch_raw(&self, framework: &str) -> Result, CoreError> { - let mut req = self.http.get(self.catalog_url(framework)); + let Some(url) = self.catalog_url(framework) else { + return Err(CoreError::Http( + "no catalog backend configured (snapshot-only mode)".to_string(), + )); + }; + let mut req = self.http.get(url); if let Some(token) = &self.token { req = req.bearer_auth(token.expose_secret()); } @@ -178,15 +202,20 @@ mod tests { "props":[],"parts":[{"name":"statement","prose":"require mfa"}]}]}]}}"#; fn provider(dir: &std::path::Path) -> OscalControlsProvider { - OscalControlsProvider::new(reqwest::Client::new(), "http://unused/", None, dir) + OscalControlsProvider::new( + reqwest::Client::new(), + Some("http://unused/".to_string()), + None, + dir, + ) } #[test] fn builds_catalog_url_and_snapshot_path() { let p = provider(std::path::Path::new("/snap")); assert_eq!( - p.catalog_url("cra"), - "http://unused/api/compliance/v1/oscal/catalog?framework=cra" + p.catalog_url("cra").as_deref(), + Some("http://unused/api/compliance/v1/oscal/catalog?framework=cra") ); assert_eq!( p.snapshot_path("cra"), @@ -226,4 +255,33 @@ mod tests { assert_eq!(doc.framework(), Some(ComplianceFramework::Cra)); let _ = std::fs::remove_dir_all(&dir); } + + /// The snapshot shipped in the image must parse and carry the full CRA + /// catalog — a truncated or reshaped refresh would silently disable control + /// mapping in snapshot-only environments. + #[test] + fn shipped_cra_snapshot_parses_with_all_controls() { + const SHIPPED: &str = include_str!("../../controls/snapshot/oscal-catalog-cra.json"); + let doc: OscalDocument = serde_json::from_str(SHIPPED).unwrap(); + assert_eq!(doc.framework(), Some(ComplianceFramework::Cra)); + assert_eq!(doc.to_controls().len(), 40); + } + + #[tokio::test] + async fn snapshot_only_mode_serves_baked_catalog() { + let dir = std::env::temp_dir().join(format!("oscal-test-{}", uuid::Uuid::new_v4())); + assert!(!OscalControlsProvider::has_snapshots(&dir)); + let online = provider(&dir); + online + .write_snapshot("cra", MINI_CATALOG.as_bytes()) + .await + .unwrap(); + assert!(OscalControlsProvider::has_snapshots(&dir)); + let offline = OscalControlsProvider::new(reqwest::Client::new(), None, None, &dir); + assert!(offline.catalog_url("cra").is_none()); + let doc = offline.load(ComplianceFramework::Cra).await.unwrap(); + assert_eq!(doc.to_controls().len(), 1); + assert!(offline.load_master_controls().await.is_err()); + let _ = std::fs::remove_dir_all(&dir); + } } diff --git a/compliance-agent/src/controls/scan_triage.rs b/compliance-agent/src/controls/scan_triage.rs index 74cfe98..826dd83 100644 --- a/compliance-agent/src/controls/scan_triage.rs +++ b/compliance-agent/src/controls/scan_triage.rs @@ -38,15 +38,9 @@ pub async fn triage_repo_findings( repo_path: &Path, findings: &mut [Finding], ) -> usize { - let Some(base_url) = config.breakpilot.base_url.clone() else { - return 0; // control triage is opt-in via BREAKPILOT_BASE_URL + let Some(provider) = provider_for(config) else { + return 0; // control triage is opt-in via BREAKPILOT_BASE_URL or a snapshot }; - let provider = OscalControlsProvider::new( - reqwest::Client::new(), - base_url, - config.breakpilot.token.clone(), - &config.breakpilot.snapshot_dir, - ); let specs = build_specs(&provider).await; if specs.is_empty() { return 0; @@ -84,6 +78,22 @@ pub async fn triage_repo_findings( } /// Build the control requirement specs (by id) from the ingested OSCAL catalog. +/// The catalog source for this agent: the breakpilot backend when +/// `BREAKPILOT_BASE_URL` is set, else the baked/previously written snapshots +/// under `BREAKPILOT_SNAPSHOT_DIR`. `None` = control triage is off. +fn provider_for(config: &AgentConfig) -> Option { + let snapshot_dir = Path::new(&config.breakpilot.snapshot_dir); + if config.breakpilot.base_url.is_none() && !OscalControlsProvider::has_snapshots(snapshot_dir) { + return None; + } + Some(OscalControlsProvider::new( + reqwest::Client::new(), + config.breakpilot.base_url.clone(), + config.breakpilot.token.clone(), + snapshot_dir, + )) +} + async fn build_specs(provider: &OscalControlsProvider) -> HashMap { let mut specs = HashMap::new(); match provider.load(ComplianceFramework::Cra).await { @@ -121,15 +131,9 @@ pub async fn grounded_surface_findings( repo_path: &Path, repo_id: &str, ) -> Vec { - let Some(base_url) = config.breakpilot.base_url.clone() else { + let Some(provider) = provider_for(config) else { return Vec::new(); }; - let provider = OscalControlsProvider::new( - reqwest::Client::new(), - base_url, - config.breakpilot.token.clone(), - &config.breakpilot.snapshot_dir, - ); let specs = build_specs(&provider).await; if specs.is_empty() { return Vec::new(); @@ -183,15 +187,9 @@ pub async fn semantic_stamp_findings( repo_path: &Path, findings: &mut [Finding], ) -> usize { - let Some(base_url) = config.breakpilot.base_url.clone() else { + let Some(provider) = provider_for(config) else { return 0; }; - let provider = OscalControlsProvider::new( - reqwest::Client::new(), - base_url, - config.breakpilot.token.clone(), - &config.breakpilot.snapshot_dir, - ); let doc = match provider.load_master_controls().await { Ok(d) => d, Err(e) => { diff --git a/compliance-agent/tests/c5_semantic_live.rs b/compliance-agent/tests/c5_semantic_live.rs index 37a422c..11b07f1 100644 --- a/compliance-agent/tests/c5_semantic_live.rs +++ b/compliance-agent/tests/c5_semantic_live.rs @@ -45,7 +45,7 @@ async fn c5_ingest_master_controls_catalog() { let provider = OscalControlsProvider::new( reqwest::Client::new(), - env("BREAKPILOT_BASE_URL"), + Some(env("BREAKPILOT_BASE_URL")), None, std::env::temp_dir().join("c5-ingest-snap"), ); diff --git a/docker/agent-entrypoint.sh b/docker/agent-entrypoint.sh index 07fcc91..c93bc8b 100644 --- a/docker/agent-entrypoint.sh +++ b/docker/agent-entrypoint.sh @@ -16,4 +16,19 @@ if [ ! -e /nix/store ]; then 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 "$@" diff --git a/docs/features/control-mapping.md b/docs/features/control-mapping.md index d39b56d..2a4560b 100644 --- a/docs/features/control-mapping.md +++ b/docs/features/control-mapping.md @@ -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-.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 diff --git a/scripts/refresh-oscal-snapshot.sh b/scripts/refresh-oscal-snapshot.sh new file mode 100755 index 0000000..2b66f11 --- /dev/null +++ b/scripts/refresh-oscal-snapshot.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Refresh the committed OSCAL catalog snapshots from a breakpilot-compliance +# backend. The agent image ships these files and seeds them into +# BREAKPILOT_SNAPSHOT_DIR on start, so control mapping works without the +# backend (see docs/features/control-mapping.md). +# +# BREAKPILOT_BASE_URL=https://api-dev.breakpilot.ai \ +# BREAKPILOT_TOKEN= \ +# scripts/refresh-oscal-snapshot.sh [framework ...] +# +# Default frameworks: cra. `master-controls` is DB-derived and large (~3k +# controls); pass it explicitly when the backend is healthy and you want the +# semantic pass to work offline too. +set -euo pipefail + +: "${BREAKPILOT_BASE_URL:?set BREAKPILOT_BASE_URL}" +out="$(cd "$(dirname "$0")/.." && pwd)/compliance-agent/controls/snapshot" +mkdir -p "$out" +frameworks=("$@") +[ ${#frameworks[@]} -eq 0 ] && frameworks=(cra) + +for fw in "${frameworks[@]}"; do + url="${BREAKPILOT_BASE_URL%/}/api/compliance/v1/oscal/catalog?framework=${fw}" + tmp="$(mktemp)" + code=$(curl -sS -o "$tmp" -w '%{http_code}' \ + ${BREAKPILOT_TOKEN:+-H "Authorization: Bearer ${BREAKPILOT_TOKEN}"} "$url") + if [ "$code" != "200" ]; then + echo "refresh-oscal-snapshot: $fw -> HTTP $code" >&2 + head -c 200 "$tmp" >&2; echo >&2 + rm -f "$tmp"; exit 1 + fi + python3 -c 'import json,sys; json.dump(json.load(open(sys.argv[1])), open(sys.argv[2],"w"), indent=2, ensure_ascii=False); open(sys.argv[2],"a").write("\n")' \ + "$tmp" "$out/oscal-catalog-${fw}.json" + rm -f "$tmp" + n=$(python3 -c 'import json,sys; d=json.load(open(sys.argv[1])); c=d.get("catalog",d); print(sum(len(g.get("controls",[])) for g in c.get("groups",[])))' "$out/oscal-catalog-${fw}.json") + echo "refresh-oscal-snapshot: $fw -> $out/oscal-catalog-${fw}.json ($n controls)" +done -- 2.54.1