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 .github/workflows/scopemoat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check out the base branch (engine, store and baseline come from it)
- name: Check out the base branch (store and baseline come from it; pr_check.py runs a copy of its engine)
run: |
git fetch --no-tags origin "${{ github.event.pull_request.head.sha }}"
git checkout --detach "${{ github.event.pull_request.base.sha }}"
Expand Down
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` (122 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` (140 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
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,21 @@ A shallow clone skips the T4 rescore; a ZIP download (no git) skips the T4 and T
## How it uses Relate

- **Mode: single file.** The baseline `graph/brightline.rl` is committed to the repo and opened read-only. Each check copies it into an in-memory Relate database and tests the change in a transaction that is rolled back. No server runs.
- **The graph:** fictional systems with zones, network links (`CONNECTS_TO`, with segmentation) and data flows (`SENDS`, `PAN` or `TOKEN`). For each check ScopeMoat writes per-direction `REACH` evidence and runs one Cypher 25 path query (`PATH_QUERY` in [scopemoat/reach.py](scopemoat/reach.py)) before and after the change.
- **The graph:** fictional systems with zones, network links (`CONNECTS_TO`, with segmentation) and data flows (`SENDS`, `PAN` or `TOKEN`). For each check ScopeMoat writes per-direction `REACH` evidence and runs Relate's Cypher 25 queries for every in-scope class before and after the change ([scopemoat/relate_scope.py](scopemoat/relate_scope.py); the transit path query is `PATH_QUERY` in [scopemoat/reach.py](scopemoat/reach.py)).
- **The same file serves** the commit hook, `gate --explain`, the diagram above, Relate's own read-only MCP server (`relate serve --mcp stdio --database graph/brightline.rl --read-only`) and the browser explorer, which runs Relate's WebAssembly build.

### What Relate decides, and what Python decides

| Decision | Who makes it |
|---|---|
| Which network links the staged Compose file adds | Python ([scopemoat/compose.py](scopemoat/compose.py)) |
| Which systems reach card data through other systems, and by which path | Relate: one Cypher query over `graph/brightline.rl` |
| Which edit opened the new path | Relate's row (`changes` column) |
| The other scoping rules, and BLOCK, PASS or REVIEW REQUIRED | 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) |
| 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 |
| 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. [experiments/relate_classes.py](experiments/relate_classes.py) is a second implementation of every in-scope class in Cypher, and `verify.py` checks that it agrees with the Python rules. In this implementation, without Relate the demo change drops to REVIEW REQUIRED and loses its path. Substituting ScopeMoat's separate Python search for Relate reproduces BLOCK and the same path for this case, but without the Relate path line or the "Opened by" attribution. Run `.venv/bin/python experiments/relate_ablation.py` with `shipped`, `no_relate` or `python_transit` ([experiments/relate_ablation.py](experiments/relate_ablation.py)).
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)).

## Checked against published answer keys

Expand Down Expand Up @@ -107,7 +108,7 @@ The same rules against keys the author wrote: the 40 frozen cases; T4, the autho

| 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 2-3), [AUDIT.md](blind/baselines/AUDIT.md) (line 7) |
| 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) |
Expand All @@ -128,12 +129,12 @@ The 40-case key was written by the author, 17 of those cases were used to develo
- [G-DIR](provider_reference/GAPS.md): when a one-way connection's control is unstated, the stated direction is lost.
- [G-SEG](provider_reference/GAPS.md): "a connection exists, its control is not stated" is recorded as missing evidence. All 7 UNRESOLVED provider labels come from it.
- C6b default forwarding ([GAPS.md](provider_reference/GAPS.md), [RULE_TO_SSC.md](provider_reference/RULE_TO_SSC.md)): a restricted hop with no relay fact forwards under `in_scope`. This is ScopeMoat's policy, not SSC text. The demo BLOCK depends on it, and so do two sensitivity variants.
- Segmentation is a recorded property, not linked to a test report. Firewalls, people and processes are not modeled. The commit gate understands one change type: services on plain Compose networks. Anything else is REVIEW REQUIRED, and `git commit --no-verify` skips the local hook.
- Segmentation is a recorded property, not linked to a test report. Firewalls, people and processes are not modeled. The commit gate understands one change type: services on plain Compose networks. Anything else is REVIEW REQUIRED, and `git commit --no-verify` skips the local hook. The gate models network membership, not application settings such as a database URL in an environment variable. The local hook runs the engine in your working tree.
- A scoping aid on modeled graphs, not a QSA assessment. PASS means "no modeled scope expansion".

## Pull request check

The same gate runs on every pull request ([.github/workflows/scopemoat.yml](.github/workflows/scopemoat.yml), [ci/pr_check.py](ci/pr_check.py)). The result is the gate's own exit code: PASS succeeds, and BLOCK, REVIEW REQUIRED and ERROR fail. [Pull request #1](https://github.com/Innov8zig/ScopeMoat/pull/1) is the live demo. It is kept open and is not meant to be merged.
The same gate runs on every pull request ([.github/workflows/scopemoat.yml](.github/workflows/scopemoat.yml), [ci/pr_check.py](ci/pr_check.py)). The result is the gate's own exit code: PASS succeeds, and BLOCK, REVIEW REQUIRED and ERROR fail. [Pull request #1](https://github.com/Innov8zig/ScopeMoat/pull/1) is the live demo. It is kept open and is not meant to be merged. The check runs the base branch's engine, and a pull request that changes the gate itself (`scopemoat/`, `scopeguard/`, `ci/`, `.github/`, `requirements.txt`) is held for review. GitHub runs a pull request's own workflow file, so changes under `.github/` still need a human reviewer.

## Files

Expand All @@ -156,7 +157,7 @@ Records under `blind/`, `t3/runs/`, `t4/runs/` and `provider_reference/results/`

- Claude (Anthropic) helped write and test the code and the documents. claude-sonnet-5-5 is the coding agent under test in `t3/`, `t4/` and `t5/`.
- ChatGPT (OpenAI) reviewed the engine and the Relate integration in hostile review rounds. Codex (OpenAI) independently re-ran the benchmark scorer's freeze candidates.
- No model decides a verdict: Relate finds the paths, and Python applies the scoping policy.
- No model decides a verdict: Relate's Cypher computes the in-scope classes and paths, the Python rules recheck them, and Python handles unresolved evidence.

## License and notices

Expand Down
Loading
Loading