Skip to content

Commit 74f5298

Browse files
alexngaicursoragent
andcommitted
feat(parity): add the WP-02 gate and record the absent prior art
The design decision was to follow OpenCode, which turned out to have no workspace trust at all: the report is anomalyco/opencode#6361, closed by a stale bot after ninety days rather than by a fix. Claude Code is the only shipped reference and has published two CVEs against its own gate, both ordering rather than policy. docs/63 records that, and FX-TRUST-003/004 are regressions against the second one. Co-authored-by: Cursor <[email protected]>
1 parent 5a87991 commit 74f5298

4 files changed

Lines changed: 53 additions & 11 deletions

File tree

‎docs/63-product-parity-roadmap.md‎

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ Calendar duration and person-week loading are separate. Package gates include pa
535535

536536
| Release | Weeks | Package estimates (person-weeks) | Feature A/B/C | Quality A/B/C | Total | Capacity | Slack |
537537
|---|---:|---|---:|---:|---:|---:|---:|
538-
| R1 | 1–9 | `00` 4 ✔; `00a` 4 ✔; `01` 1 ✔; `02` 2; `03` 1 ✔; `04` 2; `05` 2; `06` 2 | 7/4/7 | 2/5/2 | 27 | 27 | 0 |
538+
| R1 | 1–9 | `00` 4 ✔; `00a` 4 ✔; `01` 1 ✔; `02` 2 ✔; `03` 1 ✔; `04` 2; `05` 2; `06` 2 | 7/4/7 | 2/5/2 | 27 | 27 | 0 |
539539
| R2 | 10–17 | `07` 3; `08` 3; `09` 1; `10` 2; `11` 3; `12` 2 | 3/6/5 | 3/1/2 | 20 | 24 | 4 |
540540
| R3 | 18–27 | `13`–`18` 3 each | 6/6/6 | 3/3/3 | 27 | 30 | 3 |
541541
| R4 | 28–35 | `19` 3; `20` 3; `21` 4; `22` 3; `23` 3; `24` 3 | 5/7/7 | 3/1/1 | 24 | 24 | 0 |
@@ -561,7 +561,7 @@ Dependency- and owner-constrained schedule:
561561

562562
| Release | Feature schedule | Cross-package quality schedule | Slack |
563563
|---|---|---|---|
564-
| R1 | `WP-00` B/C w1–2 ✔; `00a` A/C w3–4 ✔; `01` C w5 ✔; `02` A w5–6; `03` A w7 ✔; `04` A w8–9; `05` B w4–5; `06` C w6–7 | A w1–2; B w3,w6–9; C w8–9 | none |
564+
| R1 | `WP-00` B/C w1–2 ✔; `00a` A/C w3–4 ✔; `01` C w5 ✔; `02` A w5–6 ✔; `03` A w7 ✔; `04` A w8–9; `05` B w4–5; `06` C w6–7 | A w1–2; B w3,w6–9; C w8–9 | none |
565565
| R2 | `WP-07` B w10–12; `08` B w13–15; `09` A w10; `11` C w10 + A w12–13; `12` C w14–15; `10` C w16–17 | A w14–16; B w16; C w11–12 | A w11,w17; B w17; C w13 |
566566
| R3 | `WP-13` A w18–20; `16` B w18–20; `14` C w21 + A w21–22; `15` C w23 + B w23–24; `17` C w24–26; `18` A/B/C w27 | A w23–25; B w21–22,w25; C w18–20 | A/B w26; C w22 |
567567
| R4 | `WP-19` B w28–29 + C w28; `20` A w28–29 + C w29; `21` A/B w30–31; `22` C w30 + B w32–33; `23` C w31 + A w32 + B w34; `24` C w32–34 | A w33–35; B/C w35 | none |
@@ -668,17 +668,31 @@ What encoding the contract found: three release exit gates claimed capabilities
668668

669669
#### `WP-02` Repository trust and configuration provenance — 2 person-weeks, A
670670

671-
Depends on `WP-01`.
671+
Depends on `WP-01`. Delivered.
672672

673-
- Canonical repository identity.
674-
- Trust record bound to root and executable configuration hashes.
673+
- Canonical repository identity, symlink-resolved, so one workspace is one decision.
674+
- Trust record bound to root and executable configuration hashes, at `~/.openswarm/trust.json`.
675675
- Trust invalidation on relevant configuration change.
676676
- Disable Claude SDK project `settingSources` before trust.
677-
- Include workspace skills, instructions, hooks, MCP, plugins, and LSP configuration in provenance/trust.
677+
- Include workspace skills, instructions, hooks, MCP, plugins, and LSP configuration in provenance/trust. LSP has no reader yet; `WP-21` adds one to an existing gate rather than a new one.
678678
- Preserve user-level trust independently from workspace trust.
679679
- No hook, MCP, plugin, or LSP activation before trust.
680680

681-
Gate: malicious-clone fixtures cause zero process, network, or secret activity before trust.
681+
Gate: `./scripts/verify-parity-wp.sh WP-02 <cell>`, `T1`–`T6` passing, over `FX-TRUST-001..006`.
682+
683+
**There was no prior art to copy, which is itself the finding.** The design decision was to follow OpenCode, and OpenCode has no workspace trust: the report is [sst/opencode#6361](https://github.com/sst/opencode/issues/6361), which describes this exact vulnerability and was closed by a stale bot after ninety days rather than by a fix, over an objection that it was an open security report. The follow-up request was closed by its own author. What OpenCode does ship is `OPENCODE_DISABLE_PROJECT_CONFIG`, an all-or-nothing switch. The dialog below is the one proposed in that thread and never built.
684+
685+
Claude Code is the only agent shipping a trust gate, and it has published two CVEs against it. Both are ordering, not policy. `CVE-2025-59536` executed project code before the dialog was accepted. `CVE-2026-33068` read the repository's `.claude/settings.json` first, so a repo setting `defaultMode: bypassPermissions` put the session in a permissive mode and the permissive mode caused the dialog to be skipped — the repository argued its way out of the check meant to vet it. Both fixes moved the gate earlier and changed nothing else. `FX-TRUST-003` and `FX-TRUST-004` are regressions against that second one.
686+
687+
That evidence reframed the package. The bullets above read as checks to add; the cost is in *where the decision happens*. MCP servers were spawned inside `buildAgentRuntime`, so a malicious `.openswarm/mcp.json` got its subprocess before any prompt existed to refuse it. An OpenCode contributor hit the identical wall in that thread — "config and plugins loaded before any gui, how do we get around that?" — which is good evidence the shape is inherent to the architecture rather than to either codebase.
688+
689+
Two properties keep the CVEs out. The gate reads only the user-level trust store and the *hashes* of workspace files, never their settings, so no repository-supplied value lies on the path to the decision. And its result is inert data — a `TrustDecision`, not a mode — that `buildAgentRuntime` takes as a required argument, so a runtime cannot be assembled without one. The gate cannot be skipped by forgetting it; it has to be passed something.
690+
691+
An untrusted workspace is degraded, not dead: repository configuration is dropped while the user's own is kept, because a hostile clone should not also cost someone the hooks they configured themselves. Nothing is prompted for when a workspace contains nothing executable, which is what keeps the dialog rare enough to be read. Two deviations from Claude Code are deliberate. Their trust verification is disabled entirely under `-p`, leaving piped and CI invocations unprotected; here a non-interactive run loads no repository configuration and says so, matching the headless deny-by-default position taken above, with `OPENSWARM_TRUST_WORKSPACE` as the opt-in. And the prompt lists what would be activated, including the permission mode a repository asks for, since a dialog naming no specifics is one people dismiss.
692+
693+
The gate's own threshold is proven by running the built CLI in a hostile repository and looking for evidence, not by asking each loader whether it behaved: every fixture payload writes a marker file, and `T2` asserts the directory stays empty. Each refusal is paired with a positive control that grants trust and watches the same payload fire, so a corpus that stopped exercising the attack cannot report success. Wiring the gate also surfaced two live in-repository activations that the survey's file-by-file reading had not connected: this repository's own plugin fixtures load through `OPENSWARM_PLUGINS_DIR` pointing inside the workspace, and its integration suite authors a hook config and expects it honoured. Both now state their trust explicitly.
694+
695+
Residual, carried rather than claimed closed: on the `claude-sdk` engine the SDK reads project settings itself, so the only available lever is whether `settingSources` is passed at all — OpenSwarm cannot filter that file, only decline it wholesale.
682696

683697
#### `WP-03` Canonical path authorization — 1 person-week, A
684698

@@ -1104,7 +1118,7 @@ Security:
11041118

11051119
`WP-00 → WP-00a → WP-01 → WP-02/WP-03 → WP-04 → WP-09 → WP-13 → WP-14 → WP-25 → WP-29 → WP-30 → WP-32 → WP-33`
11061120

1107-
The first three are delivered, and so is `WP-03`. `WP-02` is now the sole head of this path, `WP-06` of the swarm-correctness path below, and `WP-05` of the sessions path; each depended only on `WP-01`, so R1's remaining four packages are unblocked and can proceed in parallel across all three owners. `WP-04` is the only R1 package still blocked, waiting on `WP-02`.
1121+
The first five are delivered: `WP-00`, `WP-00a`, `WP-01`, `WP-02`, and `WP-03`. `WP-04` is now the head of this path, and its blocking dependency is cleared. `WP-06` heads the swarm-correctness path below and `WP-05` the sessions path; both depended only on `WP-01`, so all three remaining R1 packages are unblocked and can proceed in parallel across all three owners. `bun scripts/parity-ready.ts` derives this from the manifest rather than from this paragraph.
11081122

11091123
Sessions:
11101124

‎scripts/verify-parity-wp.sh‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ list_targets() {
5454
echo " WP-00 effect-transaction walking skeleton"
5555
echo " WP-00a production adoption of the frozen contracts (partial)"
5656
echo " WP-01 capability manifest and evidence harness"
57+
echo " WP-02 repository trust and configuration provenance"
5758
echo " WP-03 canonical path authorization"
5859
echo
5960
echo "Declared but not yet implemented (exit 2):"
6061
printf '%s\n' "${KNOWN_WPS[@]:1}" \
61-
| grep -vx -e 'WP-00' -e 'WP-00a' -e 'WP-01' -e 'WP-03' \
62+
| grep -vx -e 'WP-00' -e 'WP-00a' -e 'WP-01' -e 'WP-02' -e 'WP-03' \
6263
| paste -sd' ' - | fold -sw 76 | sed 's/^/ /'
6364
echo
6465
echo "See docs/63-product-parity-roadmap.md for each gate's fixtures and threshold."
@@ -306,6 +307,33 @@ case "$WP" in
306307
fi
307308
;;
308309

310+
WP-02)
311+
# Repository trust and configuration provenance. Threshold (docs/63):
312+
# malicious-clone fixtures cause zero process, network, or secret activity
313+
# before trust. T2 is the one that actually establishes that — it runs the
314+
# built CLI in a hostile repository and looks for evidence, rather than
315+
# asking each loader whether it behaved.
316+
FIXTURES="FX-TRUST-001..006"
317+
if ! ensure_deps; then
318+
RESULT="error"
319+
FAIL=$((FAIL + 1))
320+
else
321+
run_check T1 "FX-TRUST-001..006 a malicious clone activates nothing" \
322+
npx vitest run src/trust/malicious-clone.test.ts
323+
# Needs dist/: the probe runs the real entry point, not an import of it.
324+
run_check T2 "opening a hostile repository leaves no evidence behind" \
325+
sh -c "npm run build && npx vitest run src/trust/startup-activation.test.ts"
326+
run_check T3 "an untrusted workspace keeps the user's own configuration" \
327+
npx vitest run src/hooks/ src/mcp/
328+
run_check T4 "the SDK is not handed project settings before trust" \
329+
npx vitest run src/engine/claude-agent-sdk.test.ts
330+
run_check T5 "skill discovery honours the trust decision" \
331+
npx vitest run src/skills/
332+
run_check T6 "runtime assembly cannot be reached without a decision" \
333+
npx vitest run src/cli/runtime.test.ts
334+
fi
335+
;;
336+
309337
*)
310338
echo " no gate implemented for $WP yet."
311339
echo " Its fixtures and threshold are specified in docs/63-product-parity-roadmap.md;"

‎src/parity/validate.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe("the shipped manifest", () => {
8686
const built = WORK_PACKAGES.filter((wp) => wp.gateImplemented).map(
8787
(wp) => wp.id,
8888
);
89-
expect(built).toEqual(["WP-00", "WP-00a", "WP-01", "WP-03"]);
89+
expect(built).toEqual(["WP-00", "WP-00a", "WP-01", "WP-02", "WP-03"]);
9090
});
9191

9292
it("records the three capabilities whose evidence lands after the release that claimed them", () => {

‎src/parity/work-packages.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const WORK_PACKAGES: readonly WorkPackage[] = [
5454
dependsOn: ["WP-01"],
5555
cells: ["linux-x64"],
5656
fixtures: ["FX-TRUST-001..006"],
57-
gateImplemented: false,
57+
gateImplemented: true,
5858
},
5959
{
6060
id: "WP-03",

0 commit comments

Comments
 (0)