docs(design): deriving checks from breakpilot-compliance controls (#383)
CI / Check (push) Skipped
CI / Check (pull_request) Canceled after 0s
CI / Detect Changes (pull_request) Canceled after 0s
CI / Deploy Agent (pull_request) Canceled after 0s
CI / Deploy Dashboard (pull_request) Canceled after 0s
CI / Deploy Docs (pull_request) Canceled after 0s
CI / Deploy MCP (pull_request) Canceled after 0s
CI / Check (push) Skipped
CI / Check (pull_request) Canceled after 0s
CI / Detect Changes (pull_request) Canceled after 0s
CI / Deploy Agent (pull_request) Canceled after 0s
CI / Deploy Dashboard (pull_request) Canceled after 0s
CI / Deploy Docs (pull_request) Canceled after 0s
CI / Deploy MCP (pull_request) Canceled after 0s
A draft for agreement with the breakpilot-compliance side: gate by verification method, derive check texts and surface terms from the controls' objectives, rule candidates behind a test gate and review, retrieval at scale, and one mapping instead of two. Design notes are excluded from the published docs. 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:
1 parent
fdf22e99c0
commit
ed32585e37
2 files changed
+157
No files matched your search
@@ -10,6 +10,8 @@ export default withMermaid(defineConfig({
|
||||
ignoreDeadLinks: [
|
||||
/localhost/,
|
||||
],
|
||||
// Internal design notes live next to the docs but are not published.
|
||||
srcExclude: ['design/**'],
|
||||
themeConfig: {
|
||||
nav: [
|
||||
{ text: 'Guide', link: '/guide/getting-started' },
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
# Deriving checks from breakpilot-compliance controls
|
||||
|
||||
**Status:** draft for agreement with the breakpilot-compliance side (#383) · 2026-09-25
|
||||
**Not published:** `docs/design/` is excluded from the documentation site.
|
||||
|
||||
## Why
|
||||
|
||||
Prüfwerk tells a manufacturer where its product stands against the CRA. The controls
|
||||
come from breakpilot-compliance ("dsms"); the checks come from us. Today the two meet
|
||||
late: our tools find things, and our hand-written map says afterwards which control a
|
||||
finding belongs to. Nothing we check is derived from a control. This note proposes how
|
||||
dsms controls should drive what Prüfwerk checks, without ever letting an LLM decide
|
||||
coverage.
|
||||
|
||||
## How it works today
|
||||
|
||||
1. **Detectors run on their own:** semgrep (the registry and our CRA rule pack),
|
||||
cppcheck, gitleaks, syft/osv and the PLC linter.
|
||||
2. **Our control map** (`control-map/data/cra_control_map.json`, written and reviewed by
|
||||
us) binds each of the 40 CRA Annex I controls to the tools, rule ids, CWEs and
|
||||
languages that check it: 21 covered, 19 not checkable in code.
|
||||
3. **Triage.** A finding is matched to its controls through the map. The LLM judge
|
||||
confirms each match against the code, reading the binding's own check text (#381),
|
||||
and every confirmation has to quote the code verbatim (the grounding gate). The judge
|
||||
never removes a finding (#367).
|
||||
4. **Grounded surface checks** cover the eight controls violated by an absence: no
|
||||
update signature, no security logging, and so on. A hand-written keyword list per
|
||||
control finds the code, and the judge decides (#376).
|
||||
5. **Status.** The CRA status says "no violation found" only where a rule covered the
|
||||
scanned languages and every tool it relies on completed (#368, #387).
|
||||
|
||||
**Where the dsms controls come in:**
|
||||
|
||||
| Source | What it is | Used for | Live on staging and production |
|
||||
| --- | --- | --- | --- |
|
||||
| CRA catalog (`oscal-catalog-cra.json`) | 40 controls, with severity, evidence type and Annex anchor | judge prose, ratings on the CRA status | yes, as a baked snapshot |
|
||||
| Master controls (`?framework=master-controls`) | about 2,900 code-checkable controls, clustered | semantic mapping (5c) | **no**: not shipped (#382) |
|
||||
|
||||
**Gaps this note addresses:**
|
||||
- The binding between a check and a control is ours alone; dsms never sees it.
|
||||
- The surface keywords are hard-coded in Rust (`controls/surface.rs`) rather than derived from control text.
|
||||
- No new check can come out of a control.
|
||||
- dsms maps our findings to CRA requirements a second time, by CWE (`cra_finding_mapper.py`, `_CWE_TO_REQ`), next to ours.
|
||||
|
||||
## Principles (unchanged)
|
||||
|
||||
- **Tools detect, the LLM judges.** Every finding comes from a deterministic detector
|
||||
or a grounded surface check. The LLM confirms or refutes a mapping, quoting code.
|
||||
- **Coverage is decided by people.** Which control is checked by which rule is
|
||||
reviewed and versioned, never inferred at scan time.
|
||||
- **A claim needs a check that ran.** No "no violation found" without a rule for the
|
||||
language and a tool that completed.
|
||||
|
||||
## Proposal
|
||||
|
||||
### 1. Gate: which controls Prüfwerk checks at all
|
||||
|
||||
dsms knows how each control is evidenced:
|
||||
- **master controls:** `mc_verification`: `source_code`, `network`, `it_process`, `document`, `manual`, `hybrid`;
|
||||
- **CRA:** `evidence-type`: `code`, `process`, `hybrid`, `document`.
|
||||
|
||||
We use that as the gate:
|
||||
|
||||
| dsms method | Lane |
|
||||
| --- | --- |
|
||||
| `source_code`, `code` | Prüfwerk static analysis |
|
||||
| `network` | Prüfwerk dynamic tests (DAST, TLS, ports; the Werkbank runner) |
|
||||
| `hybrid` | both: the code part here, the process part in dsms |
|
||||
| `it_process`, `process`, `document`, `manual` | dsms (process evidence) |
|
||||
|
||||
Controls outside our lane stay "not checkable in code" on our side and are evidenced in
|
||||
dsms. **Ask A1:** export the verification method as an OSCAL prop for master controls
|
||||
(CRA already has `evidence-type`).
|
||||
|
||||
### 2. What each control asks, in terms a check can use
|
||||
|
||||
A control's statement is written for auditors ("SAST … in der CI/CD-Pipeline"), not for
|
||||
code. dsms has more: `test_procedure[]` and `requirements[]` on canonical controls,
|
||||
which its OSCAL import drops and its export does not carry yet.
|
||||
|
||||
**Ask A2:** export them as OSCAL `assessment-objective` parts.
|
||||
|
||||
We then derive, once per control and version, reviewed by a person:
|
||||
- **check texts per binding** (today written by hand, #381);
|
||||
- **surface terms per language** for the grounded check (today hard-coded in `surface.rs`), with C/C++, ST/SCL and the web languages as separate lists.
|
||||
|
||||
Derived data lives in the control map, keyed by the control id and the catalog's
|
||||
content hash. A catalog change shows up as a failing parity test (#381), not as a silent
|
||||
drift.
|
||||
|
||||
### 3. New rules from controls (candidates, never automatic)
|
||||
|
||||
For a code-checkable control that no rule covers:
|
||||
|
||||
1. From the control's objectives, an LLM drafts a semgrep rule, plus positive and
|
||||
negative examples.
|
||||
2. The rule must parse, fire on every positive example and on none of the negative
|
||||
ones. That gate is deterministic, as in Prose2Policy's compile-and-test step.
|
||||
3. A person reviews it into `rules/cra_semgrep.yaml`, together with its binding and a
|
||||
nightly fixture.
|
||||
|
||||
dsms's Payment Compliance Pack (25 semgrep and 5 CodeQL rules tied to control ids) is the
|
||||
precedent. The difference: candidates are proposed per control, and nothing reaches a
|
||||
scan without review.
|
||||
|
||||
### 4. Retrieval at scale
|
||||
|
||||
For the master controls (about 2,900 in our lane), a finding cannot be matched through a
|
||||
hand-written map. The semantic pass (5c) embeds control text and retrieves the nearest
|
||||
controls per finding.
|
||||
|
||||
Two improvements, from prior art:
|
||||
- a **deterministic pre-filter** before the judge: the control's derived terms must occur in the region, as in IRIS;
|
||||
- a judge answer with **counter-evidence spans and a failure mode**, as in VulnAgent-R2, to cut false confirmations.
|
||||
|
||||
The unused `ControlsProvider::controls()` query API becomes the entry point.
|
||||
|
||||
**Needs #382** (ship the master-controls snapshot) and **ask A6** (access to the export).
|
||||
|
||||
### 5. One mapping, not two
|
||||
|
||||
dsms maps our findings to CRA requirements again by CWE (`_CWE_TO_REQ`). Two mappings of
|
||||
the same finding will drift. Instead:
|
||||
- Prüfwerk exports, per target, the per-control verdicts and its coverage (which controls it checks, with which tools and for which languages). The `oscal_assessment` and `get_control_mapping` MCP tools already expose most of this.
|
||||
- **Ask A5:** dsms consumes those verdicts and marks the controls Prüfwerk covers as machine-checked, keeping its CWE table only as a fallback for other scanners.
|
||||
|
||||
## Asks to breakpilot-compliance
|
||||
|
||||
| # | Ask | Why |
|
||||
| --- | --- | --- |
|
||||
| A1 | Verification method as an OSCAL prop on the master-controls export | the gate (1) |
|
||||
| A2 | `test_procedure` / `requirements` as OSCAL `assessment-objective` parts | check texts and surface terms (2), rule candidates (3) |
|
||||
| A3 | Keep control ids stable and the content hash per catalog | our map is keyed on them |
|
||||
| A4 | Umlauts in the catalog's titles and prose ("Passwörter", not "Passwoerter") | shown to customers verbatim |
|
||||
| A5 | Consume Prüfwerk's per-control verdicts and coverage; CWE table only as fallback | one mapping (5) |
|
||||
| A6 | A service token for the master-controls export | #382, retrieval (4) |
|
||||
|
||||
## What we build (stories, once agreed)
|
||||
|
||||
1. **Gate by method:** read the verification method and evidence type; controls outside our lane are "evidenced in dsms" on the CRA status.
|
||||
2. **Derived check texts and surface terms:** a reviewed, versioned import of the objectives into the control map; `surface.rs` reads its terms from there.
|
||||
3. **Rule-candidate pipeline:** LLM draft, deterministic test gate, review; one candidate per uncovered control; nightly fixture per accepted rule.
|
||||
4. **Judge answer and pre-filter:** counter-evidence spans and failure mode; deterministic term pre-filter in 5c.
|
||||
5. **Coverage export:** per-control coverage (tools, languages, last run) over MCP and in the evidence pack.
|
||||
|
||||
**Order.** Stories 1 and 5 need only A1 and A5 and give the biggest win: no double
|
||||
mapping, and an honest split between machine and process evidence. Stories 2 and 3 need
|
||||
A2. Story 4 needs #382.
|
||||
|
||||
## Open questions
|
||||
|
||||
- **Who reviews rule candidates and derived terms?** Proposal: Prüfwerk engineering, with a dsms reviewer for the control semantics.
|
||||
- **Versioning:** how often does the CRA catalog change, and do we re-derive on every change or on request?
|
||||
- **IEC 62443:** the same approach once dsms exports that catalog (#241, #236).
|
||||
- **Languages:** which ones first for derived surface terms? Proposal: C/C++ (the pilot), then ST/SCL, then the web stack.
|
||||
Reference in new issue
Block a user