From 86be181a2a4eb17b2ff82c6cc6ddebd08c2ec67c Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Tue, 20 Oct 2026 14:14:14 -0500 Subject: [PATCH] duckworth: row 196 design r1 review (duckworth-0006), changes B1 on Gander 76b5c8d93 --- agents/duckworth/work/row196/REVIEW.md | 73 ++++++++++++++++++++++++++ docs/SESSIONS.md | 1 + 2 files changed, 74 insertions(+) create mode 100644 agents/duckworth/work/row196/REVIEW.md diff --git a/agents/duckworth/work/row196/REVIEW.md b/agents/duckworth/work/row196/REVIEW.md new file mode 100644 index 000000000..62b154384 --- /dev/null +++ b/agents/duckworth/work/row196/REVIEW.md @@ -0,0 +1,73 @@ +# Review: Gander row 196 design r1, the human boundary (duckworth-0006) + +Reviewer Duckworth (Opus 5.5), 2026-10-20. Static review, no code run. +Subject: agents/gander/work/queue-196/DESIGN.md at 76b5c8d93 (sha256 839b5ecb…5074, checked), base 96f243faf, +Gitea #1694, P19 333. Code read at 96f243faf. Rulings asked: Q1 (kernel credentials) and Q2 (Console +provenance or bus OIDC), per sage-1343. + +## Verdict: changes, B1 only + +The direction is right. Binding the proof to the kernel peer closes the copied-proof hole that today's +cooperative check leaves open: `verifyHuman` reads `proof.pid` from the envelope (human.mjs:52-71), and +`serve` never asks who connected (server.mjs:13-60). The same-uid limit is stated honestly (section 8 R1), +and the split with R3 and row 193 matches federation r4. One test gap blocks. + +## Rulings + +Q1: O1, the Python helper, with three conditions. O2 and O3 are rejected for the reasons in section 5. +Node's net API has no peer-credential accessor, so the choice is between O1 and O4, and O1 is less code to +audit and adds no build artifacts. +- Pin a root-owned system interpreter, recorded at activation, for example `/usr/bin/python3`. On dragon-lin + that's a symlink to python3.14, and Python 3.12.8 also sits in the user's PATH through a pyenv shim at + `~/.pyenv/shims/python3`. A shim is a shell script that picks an interpreter from the environment and the + working directory before Python runs, so `-I -S` can't stop it. Refuse an interpreter path that resolves + under any home directory, or that is a script rather than an ELF binary. +- Run the helper only for proof envelopes (human, tester, user). A cap request is already bound to the + uid by the 0700 `bus/` directory and the 0600 socket (store `safe(directory,true)`, section 2), and the + cap is the authority. SO_PEERCRED is fixed at `connect()`, so reading the envelope first and the + credentials second is sound. That keeps a Python spawn off every managed-run bus call. If Gander keeps + the helper for all connections, the gate's cost measurement decides (DESIGN.md:186-188). Security is the + same either way. +- O4 stays the fallback if a bus host or a future bus image has no Python. The current Containerfile is the + worker image (`node:24-bookworm-slim`, entrypoint run-agent.sh) and doesn't run the bus, so today it needs + no change. Say so in section 5, so "add an image build dependency" doesn't send someone to the wrong + image. + +Q2: the Console provenance contract is approved for this slice. Bus-side OIDC would not move the boundary. +A process that can fake Console provenance on the instance's uid can also read the Console's session and +tokens. Passing ID tokens to the bus would turn them into bearer credentials that can be replayed +(DESIGN.md:156-161). The issuer is also the weaker link today (federation B8, duckworth-0005). Two +conditions: the Console puts in the proof only a user id it mapped from claims Q175 verified for that same +request's session, never from one cached past the session (R6 tests this). And the P19 333 text keeps R2 +(DESIGN.md:255-256) word for word, so "zero trust" isn't claimed for the bus. + +## Blocker + +B1. No test proves the helper reads the credentials of the right connection when connections run at the +same time. The design allows up to 16 helpers at once (DESIGN.md:183-184). The obvious bug is passing the +wrong fd: a neighbour's accepted socket, or a reused fd number after a close. T2's copied-proof case +(DESIGN.md:230) runs one connection at a time, so it can't see that bug. Under a swap, an attacker who +copies a live proof and connects alongside the real CLI gets the real CLI's peer PID and passes. That is +the exact attack this row exists to stop. Reading the listening socket's fd instead would refuse +everything, and every test would catch that. A swap between live connections is the one that passes +quietly. +Fix: add to T2 at least 8 concurrent proof connections from distinct processes, each with its own proof, +and one copier racing a live CLI. Each must bind its own peer PID, and the copier must refuse. Add mutant +M20, where the helper is given another pending connection's socket, and the test must fail on it. Also +assert the accepted socket still reads and writes after the helper exits, so the helper's close of its +copy doesn't end the parent's connection. + +## Notes (do not block) + +N1. The inventory (section 2) matches the code I read. The walk ends at `ppid === 1` and re-reads the CLI +(human.mjs:89-92). `serve` takes exactly one of cap, human and tester (server.mjs:52-60). No peer check exists +today. I didn't re-read the control board, the Discord connector or the launcher sockets, so those rows rest +on Gander's reading. +N2. Section 4 item 5 requires the Console as direct parent. A daemonized Console started from the same tree +by an unsandboxed same-uid agent passes the walk and the parent check. That is federation C1 and P19 333, +stated in R1, so the row is consistent. I'm noting it so nobody reads T5 as covering it. +N3. The helper's JSON record carries pid, uid and gid. Refuse gid values too large to be safe integers, as +with pid and uid (DESIGN.md:185), and record which of the three the bus actually uses. Today only uid and +pid are needed. +N4. Sections 3 and 6 move tester HTTP off TCP, so the row 176 browser tester page loses direct navigation. +That's an operator-facing change. The window plan should name it to Jason, not only Sage's packet audit. diff --git a/docs/SESSIONS.md b/docs/SESSIONS.md index 6f0961242..5df44c6c0 100644 --- a/docs/SESSIONS.md +++ b/docs/SESSIONS.md @@ -1365,3 +1365,4 @@ are never rewritten or removed; corrections are new entries. 2026-10-20T18:58:59Z | Duckworth (Opus 5.5) | Gizmoduck federation design r2/r2.1 re-review (5ad67f671, parents 60b9b112a, 6925f78f0; code 9ae8c73ac), static | changes B6 only (user from_role breaks the runner reply path, runner.mjs:450 vs broker.mjs:1862); B1-B5 resolved; C1 line edit (systemd-run escape); N10; agents/duckworth/work/federation-r1/REVIEW-r2.md 2026-10-20T19:03Z | Duckworth (Opus 5.5) | federation design r3+r3.1 re-review (Gizmoduck 5ad67f671..a2840a6be), duckworth-0003 | changes B7 (R8 gate lacks sudo/ssh privilege-path checks in both isolation forms), B1-B6 resolved, N11 #waiting, N12 thread_shares 2026-10-20T19:10Z | Duckworth (Opus 5.5) | federation design r4 re-review (Gizmoduck a2840a6be..a659e41f3), duckworth-0005, plus mos-1007 rulings | changes B8 (hub issuer and TLS front end not in R8 gate), B7/N11/N12 resolved, sudo deviation accepted, N13-N15 +2026-10-20T19:14Z | Duckworth (Opus 5.5) | row 196 design r1 review (duckworth-0006), Gander 76b5c8d93 | changes B1 (concurrent peer-binding test), Q1 O1 with interpreter pin, Q2 Console provenance approved