Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EVIDENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Every result ScopeMoat publishes, where its record lives, and the command that r
| Relate path query agrees with the Python reference: 0 membership mismatches over 539 fixture-by-case comparisons | main | `blind/v5/reach_crosscheck.py`, `blind/v5/reach_inventory.json` | `python acceptance.py` (check K7) |
| Browser explorer: Relate's WebAssembly build (1.4.0) returns the same rows as relate-db for every recorded state, 6/6 (proposal, repair, missing evidence; baseline and candidate each) | main | `explorer/` (index.html, data/scenarios.json, vendor/relate-wasm-1.4.0/) | `python -m explorer.build_export --check` (exit 0: data current), then `node explorer/parity.mjs` (expected `Parity: 6/6 states identical`) |
| Transit search guard: on the pinned forwarding-clique fixture, 5 forwarding systems still BLOCK with the same Relate path; 6 and 20 are held for review by the search-size guard in under 0.2 s instead of 23 s / out of memory | main | `perf/README.md`, `perf/forwarding_clique.py`, `perf/bench.py` | `python perf/bench.py 5 6 7 20`; acceptance P1-P3 |
| Engine and gate behaviour | main | `acceptance.py` (141 required checks), `blind/v5/checks_v5.py` (67), `t3/test_t3.py` (36) | `python acceptance.py`; `python blind/v5/checks_v5.py`; `python t3/test_t3.py` |
| Engine and gate behaviour | main | `acceptance.py` (145 required checks), `blind/v5/checks_v5.py` (67), `t3/test_t3.py` (36) | `python acceptance.py`; `python blind/v5/checks_v5.py`; `python t3/test_t3.py` |

## How to read these

Expand Down
52 changes: 8 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ A shallow clone skips the T4 rescore; a ZIP download (no git) skips the T4 and T
## Try the gate yourself

- **Read-only, nothing changes in your clone:** `.venv/bin/python -m scopemoat check graph/brightline.rl changes/bi_to_orders.json --explain` (Windows: `.\.venv\Scripts\python.exe -m scopemoat check graph\brightline.rl changes\bi_to_orders.json --explain`). It exits 1 and prints `VERDICT: BLOCK: 1 system(s) enter scope, 0 move into the CDE` and `Relate path: bi-dashboards -> orders-api -> checkout-api`, then the Cypher query with its parameters and Relate's rows before the change (7) and after it (8, the new one marking the added link in its `changes` column). The hook names the Compose edit ("bi-dashboards joins orders-db-net"), while `check` on a change file says "added by the change file"; it is the same link.
- **With the commit gate, in your clone:** run `.venv/bin/python -m scopemoat install-hook`, make the edit above, then `git add deploy/compose.yaml` and `git commit`. Git refuses the commit. `.venv/bin/python -m scopemoat gate --explain` prints the Cypher query and Relate's rows. `.venv/bin/python -m t3.clean_replay t3/runs/20261130T025027Z_bi_order_status/trace.json` replays the recorded proposal and repair in a temporary clone.
- **With the commit gate, in your clone:** run `.venv/bin/python -m scopemoat install-hook`, make the edit above (line 25 of `deploy/compose.yaml`: `networks: [bi-net]` becomes `networks: [bi-net, orders-db-net]`), then `git add deploy/compose.yaml` and `git commit` (on a fresh machine, set `git config user.name` and `user.email` first). Git refuses the commit. `.venv/bin/python -m scopemoat gate --explain` prints the Cypher query and Relate's rows. `.venv/bin/python -m t3.clean_replay t3/runs/20261130T025027Z_bi_order_status/trace.json` replays the recorded proposal and repair in a temporary clone.
- **Step by step:** the full walkthrough is in [docs/WALKTHROUGH.md](docs/WALKTHROUGH.md). It covers the commit gate's fail-closed rules, the `review` policy, the chokepoint query in Relate's CLI, where card data reappears, and the MCP servers.
- **No install:** [pull request #1](https://github.com/Innov8zig/ScopeMoat/pull/1) fails the change and passes the repair in GitHub Actions. The [browser explorer](https://innov8zig.github.io/ScopeMoat/explorer/) reruns the hook's query in Relate's WebAssembly build.

Expand All @@ -67,53 +67,17 @@ A shallow clone skips the T4 rescore; a ZIP download (no git) skips the T4 and T
| Which network links the staged Compose file adds | Python ([scopemoat/compose.py](scopemoat/compose.py)) |
| Which systems are in scope on recorded facts (card data systems, the CDE, systems connected to it or securing it, and systems that reach it through others), before and after the change | Relate: Cypher queries over an in-memory Relate database that ScopeMoat loads from `graph/brightline.rl` (systems, data flows, security services) plus the per-direction `REACH` evidence it writes ([scopemoat/relate_scope.py](scopemoat/relate_scope.py)) |
| Which path puts a system in scope, and which edit opened it | Relate's row (`path` and `changes` columns) |
| BLOCK or PASS | Relate's in-scope classes. The Python rules ([scopemoat/rules_v5.py](scopemoat/rules_v5.py), mapped to the PCI SSC guidance in [provider_reference/RULE_TO_SSC.md](provider_reference/RULE_TO_SSC.md)) compute the same classes independently; if the two disagree, or Relate cannot answer, the gate returns REVIEW REQUIRED |
| BLOCK or PASS | Relate's in-scope classes |
| Independent check of Relate's result | Python rules ([scopemoat/rules_v5.py](scopemoat/rules_v5.py), mapped to the PCI SSC guidance in [provider_reference/RULE_TO_SSC.md](provider_reference/RULE_TO_SSC.md)) recompute the confirmed classes, transit reachability included, with ScopeMoat's own Python path search and no Relate query (since v1.0.5). A disagreement, or no answer from Relate, puts the change into REVIEW REQUIRED |
| REVIEW REQUIRED for unresolved evidence (the worst case, every unrecorded fact treated as open) | Python rules. Relate does not run this search: on Brightline it explores more than two million trails |
| Refusing the commit | Git, through the local pre-commit hook |

No AI decides scope. Relate's queries and the Python rules are two implementations of the same rules, and the gate needs both to agree; `verify.py` checks that they agree on every frozen state. Without Relate the demo change drops to REVIEW REQUIRED and loses its path. Replacing only Relate's transit query with ScopeMoat's separate Python search still gives BLOCK, because the in-scope classes still come from Relate's queries. Run `.venv/bin/python experiments/relate_ablation.py` with `shipped` (BLOCK), `no_relate` (REVIEW REQUIRED) or `python_transit` (BLOCK) ([experiments/relate_ablation.py](experiments/relate_ablation.py)).
No AI decides scope. Relate computes confirmed scope and supplies the path shown in the demo. ScopeMoat uses Relate's result to detect scope expansion. Python independently recomputes transit reachability, and a disagreement puts the change into REVIEW REQUIRED. `verify.py` checks that the two agree on every frozen state. Without Relate the demo change drops to REVIEW REQUIRED and loses its path. Replacing only Relate's transit query with ScopeMoat's separate Python search still gives BLOCK, because the in-scope classes still come from Relate's queries. Run `.venv/bin/python experiments/relate_ablation.py` with `shipped` (BLOCK), `no_relate` (REVIEW REQUIRED) or `python_transit` (BLOCK) ([experiments/relate_ablation.py](experiments/relate_ablation.py)).

## Checked against published answer keys
## Checked against answer keys

ScopeMoat's unchanged rules, scored against published answer keys: PCI SSC 2017 and 2024, AWS and Google, two simpler baselines (B1, B2) on the same AWS and Google labels, and W3 (Google's PCI on GKE blueprint). In W3, Google labels the 3 in-scope services; the 7 out-of-scope labels are the author's inference from cluster placement. Every graph in these rows was built by the author from the published text ([provider_reference/GAPS.md](provider_reference/GAPS.md): "built from the published sources listed in SOURCES.md"). For the AWS and Google rows, the labels were committed (563e140) before the graphs (3960950, tag `provider-ref-frozen-2026-12-04`) and before any engine run, the graphs had a cold review against the cited sources ([REVIEW.md](provider_reference/REVIEW.md)), and the run was scored once ([SCORING.md](provider_reference/SCORING.md) step 7: "No run is repeated to get a different number").

In short, every number below is from the table:
- Against the published answer keys (PCI SSC 2017 and 2024, AWS and Google, Google's GKE blueprint), ScopeMoat never puts a system out of scope that the publisher puts in scope: 0 looser in every one of those rows.
- Where a source states no control on a connection, ScopeMoat holds the system in scope instead of guessing: 7 of the 25 AWS and Google labels are UNRESOLVED.
- Simpler rules can match more labels but miss in-scope systems: B1 (in scope only where card numbers are stored, processed, sent or received) matches 18 and is looser on 7; B2 (any link to a card-data system puts a system in scope) matches 20 and is looser on 1; ScopeMoat matches 15 and is looser on 0.

How to read the result column (classes as defined in [provider_reference/RULE_TO_SSC.md](provider_reference/RULE_TO_SSC.md)):
- **CDE:** the system stores, processes or transmits account data, is on the same network segment as a system handling account data, or has unrestricted connectivity to one (rules R1, R1S and R2).
- **OTHER:** "every other rule gives OTHER": in scope but not CDE, for example connected-to, providing security services to the CDE, or a usable access path to the CDE through another system.
- **OUT:** "in scope in neither case: no rule fires even with missing evidence treated as open".
- **Stricter:** ScopeMoat puts a system in scope that the publisher left out. That costs audit effort.
- **Looser:** ScopeMoat puts a system out of scope where the publisher says it is in scope. This is the dangerous error: a system that needs PCI controls is left out of the assessment.
- **UNRESOLVED:** the source states no control on a connection. ScopeMoat withholds OUT and treats the system as in scope until evidence arrives.
Of the 7 UNRESOLVED results, the publishers label 4 in scope (A1-04, A2-02, A3-01, G2-01) and 3 out of scope (A2-03, A3-05, G2-02) ([RESULTS.md](provider_reference/RESULTS.md) per-label table, lines 62, 73-76, 83-84). Treating missing evidence as closed instead of open would make those 4 looser; that is why ScopeMoat fails closed.

| Answer key (full title, year) | Compared | Result | File |
|---|---|---|---|
| PCI SSC, Guidance for PCI DSS Scoping and Network Segmentation v1.1 (May 2017) | Examples 1 and 2: 5 systems, 2 variants, 10 labels | 8 of 10 matched, 2 stricter, 0 looser | [experiments/ssc_examples/README.md](experiments/ssc_examples/README.md) |
| PCI SSC, PCI DSS Scoping and Segmentation Guidance for Modern Network Architectures (Sept 2024) | 6 examples, 15 scored labels | 15 of 15 matched; the Python rules and the Relate provider agree | [experiments/ssc_2024/README.md](experiments/ssc_2024/README.md) |
| AWS and Google Cloud published PCI reference architectures | 26 publisher labels; 25 modelable | ScopeMoat: 15 match, 3 stricter, 0 looser, 7 UNRESOLVED of 25 | [provider_reference/RESULTS.md](provider_reference/RESULTS.md) |
| Same 25 labels, baseline B1: PAN-presence oracle (a system is in scope (CDE) only if it stores or processes card numbers or is an end of a PAN or SAD flow; everything else is OUT) | 25 labels | 18 match, 0 stricter, 7 looser, 0 UNRESOLVED of 25 | [provider_reference/baselines/RESULTS.md](provider_reference/baselines/RESULTS.md) |
| Same 25 labels, baseline B2: permissive one-hop (any link to a card-data system puts a system in scope) | 25 labels | 20 match, 4 stricter, 1 looser, 0 UNRESOLVED of 25 | [provider_reference/baselines/RESULTS.md](provider_reference/baselines/RESULTS.md) |
| Google, PCI on GKE blueprint, developed for PCI DSS 3.2.1 (W3) | 3 services Google labels in scope, 7 out of scope by cluster placement; 2 variants | every label matches in both variants; the Python rules and the Relate provider agree | [experiments/w3_gke/LABELS.md](experiments/w3_gke/LABELS.md) |

B1 and B2 match more labels (18 and 20), yet they are worse: B1 is looser on 7 labels and B2 on 1, while ScopeMoat is looser on 0. B1 is the best case for any rule that looks only at where card numbers are, and it calls every connected-to and security-impacting system out of scope.

## Checked against the author's own keys

The same rules against keys the author wrote: the 40 frozen cases; T4, the author's benchmark of 12 frozen agent tasks; the twin, one change judged on two baselines that differ in one recorded fact; and T5, the pre-registered agent A/B, the same agent on the same facts with and without a Relate query tool. In short, on T4 the gate did not improve outcomes: 0 of 36 unsafe ships in both arms, and 12 of 36 safe deliveries with the gate output against 15 of 36 without. On T5 the Relate tool did not improve outcomes: 8 of 11 twin pairs fully right with it against 11 of 11 without, and 0 of 23 false PASS against 2 of 23.

| Answer key (full title, year) | Compared | Result | File |
|---|---|---|---|
| The author's answer key for 40 frozen cases, written before scoring | 40 changes | ScopeMoat: 36 exact, 0 false PASS. One-hop check: 24 exact, 15 false PASS. Plain reachability: 20 exact, 16 false PASS. Neither simpler check can return REVIEW REQUIRED, and 14 of the 40 expected verdicts are REVIEW. On the 26 expected BLOCK or PASS cases, one-hop is exact on 24 and ScopeMoat on 23 | [blind/baselines/SPLITS.txt](blind/baselines/SPLITS.txt) (lines 1-3), [AUDIT.md](blind/baselines/AUDIT.md) (line 7) |
| The author's 12 frozen agent tasks (T4), claude-sonnet-5-5, 3 repeats, 36 runs per arm, blind-scored | the same agent without and with ScopeMoat's gate output | Unsafe ships (the benchmark's scored decision category): 0 of 36 without the gate output, 0 of 36 with it. Safe deliveries: 15 of 36 without, 12 of 36 with. Under the frozen win rule the gate arm did not win (3 fewer safe deliveries, all on T4-07, where the gate returned REVIEW REQUIRED on a design the frozen answer key rates PASS) | [t4/runs/live1/README.md](t4/runs/live1/README.md) (lines 3, 9-16) |
| Twin pair P01 (from the T5 design; rule-derived label) | the demo change on two baselines that differ in one recorded fact | BLOCK becomes REVIEW REQUIRED; Relate's rows go from 8 to 0 | [experiments/twin_replay.py](experiments/twin_replay.py) |
| The author's pre-registered agent A/B (T5), claude-sonnet-5-5, one repeat, 23 singles and 11 twin pairs | the same agent with the facts as text (arm A) or the same text plus a read-only Relate Cypher tool (arm B) | Registered: "H1: B gets more twin pairs fully right than A. H2: B has no more false PASS than A." and "H1 counts as supported only if B leads on pairs and p < 0.10". Twin pairs fully right: 11 of 11 without the Relate tool (arm A), 8 of 11 with it (arm B); 3 of arm B's answers were malformed JSON, which the registered scorer counts as failures. False PASS on singles: 2 of 23 (A), 0 of 23 (B). Exact verdicts on singles: 20 of 23 (A), 21 of 23 (B). No demonstrated difference on H1, as registered ("anything else is reported as no demonstrated difference, with the counts") (A alone right on 3 pairs, B alone on 0; p = 0.25); H2 holds. B made 12 Relate queries; in no state where the arms' verdicts differed did a query return a fact the answer used (one timed out), so no result is credited to the graph. The registered audit (S1, S2) found 140 of 140 checkable cited facts in A's answers and 146 of 147 in B's in the graph, and ScopeMoat enforcing its configured policy matched the key on 34 of 35 states with 0 false PASS. The run resumed after the daily spend cap; three files off the prompt and scoring path changed in between (listed in the commit). T5 tested giving the agent raw Cypher access; ScopeMoat's gate does not depend on it (the agent receives the gate's verdict, not the graph). | [t5/runs/fri4/report.json](t5/runs/fri4/report.json), [audit.json](t5/runs/fri4/audit.json), [t5/README.md](t5/README.md) |

The 40-case key was written by the author, 17 of those cases were used to develop the rules ([blind/baselines/SPLITS.txt](blind/baselines/SPLITS.txt): 23 untuned, suite 1 of 17), and the twin label is derived from the rules.
- **Published answer keys.** Result: against keys it did not write (PCI SSC's scoping examples, 2017: 8 of 10 matched, 2 stricter; 2024: 15 of 15; AWS and Google's PCI reference architectures, 25 labels: 15 match, 3 stricter, 7 UNRESOLVED), ScopeMoat never put a system out of scope that the publisher put in scope (0 looser). Key limitation: every graph was built by the author from the published text, and the 7 UNRESOLVED labels are held for review because the source states no control (publishers label 4 of them in scope). [Full tables](docs/EVALUATION.md#checked-against-published-answer-keys)
- **The author's own keys.** Result: on 40 frozen cases it passed none of the changes the key blocks or holds for review (0 false PASS); a one-hop check passed 15 and plain reachability 16. Key limitation: the author wrote that key and used 17 of the cases to develop the rules, and two agent experiments, giving an agent the gate's output (T4) or a raw Relate query tool (T5), showed no demonstrated improvement in the agent's decisions. [Full tables](docs/EVALUATION.md#checked-against-the-authors-own-keys)

## What the graph tells an auditor, a company and a red team

Expand Down Expand Up @@ -149,7 +113,7 @@ The same gate runs on every pull request ([.github/workflows/scopemoat.yml](.git
| `t3/`, `t4/`, `t5/` | the recorded agent run and replay, the agent benchmark, the pre-registered agent A/B |
| `blind/` | the frozen 40-case comparison with simpler checks |
| `explorer/` | the browser explorer and scope page (Relate WebAssembly) |
| `verify.py`, `acceptance.py`, [EVIDENCE.md](EVIDENCE.md) | every published claim in one command, the full check suite, and the evidence index |
| `verify.py`, `acceptance.py`, [EVIDENCE.md](EVIDENCE.md) | the release checks in one command, the full check suite, and the evidence index |

Records under `blind/`, `t3/runs/`, `t4/runs/` and `provider_reference/results/` are frozen and are not edited after they are committed. A rerun is reported as a separate run.

Expand Down
Loading
Loading