Skip to content

Socket peer authentication on the client-mode relay; the #95 spec (board #95) - #104

Merged
SSFSKIM merged 27 commits into
mainfrom
spec/socket-peer-auth-95
Oct 10, 2026
Merged

SSFSKIM merged 27 commits into
mainfrom
spec/socket-peer-auth-95

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Board ticket: #95 (the board closes it after the owner's sitting). This PR carries the spec and cua's side of socket peer authentication: docs/doperpowers/specs/2026-10-09-maws-socket-peer-auth-design.md, along with its living sections and its Outcomes. MAWS's side is SSFSKIM/MAWS#7. Merge order: SSFSKIM/MAWS#7 first, then this PR. After both merge, the owner's live sitting (Acceptance 8) runs once the installed plugin is updated to 0.7.0.

What changes

In client mode, cua serve opens a relay socket ($CUA_HOME/chrome/m/<name>-<pid>.sock) for the vendor service and the trusted worker. That relay now admits a peer only if two things hold:

  • the peer runs as the same user;
  • the peer descends from that cua serve process instance.

The check runs at accept, before any read (pauseOnConnect). A refused peer is destroyed and writes one diagnostics line: relay <name>: refused peer pid <pid> (<reason>). Without the addon, every peer is refused.

  • native/peer-auth/: the N-API addon. Its C source and darwin-arm64 prebuild are byte-identical to MAWS's copies. scripts/build-peer-auth.sh rebuilds it, and native/ is added to package.json files.
  • src/chrome/peer.mjs: the loader and the ancestry policy.
  • runHost takes an authorize option, and connector() passes it. The Chrome-route host (src/chrome/host.mjs, launched by Chrome's native messaging) passes nothing and behaves as before. Its status file only gains peerCheck: 'off'.
  • The status file gains peerCheck: 'on' | 'off' | 'unavailable'.
  • cua doctor's maws.hosts row reports a missing addon as blocked, and the maws_unreachable reason text says why.
  • The plugin's server and spawnUpstream's anchor run with --disable-sigusr1.
  • The Node requirement is now ^22.14 || >=23.7, the first releases that have that flag. It is updated in engines, the cloud-VM install condition, the README, the cua-remote skill and the cloud-VM README.
  • Plugin version 0.6.0 → 0.7.0. The README's "For MAWS" section is reworded.
  • In the in-app browser spec, "Session authorization" gets a dated pointer and a Decision Log entry.

Validation Evidence

  • Tests: HOME=$(mktemp -d) npm test gives # pass 1071, # fail 0, # skipped 1 (a pre-existing Linux-only skip). Run at c43d479.
  • Mods: npm run test:mods gives 32 pass, 0 fail.
  • Plugin manifest: claude plugin validate . reports ✔ Validation passed with warnings, the same warnings as on main.
  • Acceptance 1 and 2 (test/chrome-peer.test.mjs, 15/15):
    • Addon: a child's pid and uid, a stable start time, a child that descends, and a reparented orphan that does not. An exited pid returns null. The prebuild's version is pinned, and so is the SHA-256 of the C source.
    • Policy, with fakes: the five refusal reasons in order; a dead root; a pid that changes on re-read; a start time later than the accept; the 65-step limit.
  • Acceptance 7:
    • The relay check is on in serve-maws and chrome-client-mode.
    • An orphan is refused before any read.
    • The Chrome-route host still accepts the test's orphan.
    • peerCheck is written to the status file.
    • Doctor reports unavailable when the loader points at a missing file.
    • A child started with --disable-sigusr1 opens no inspector on SIGUSR1.
    • Off darwin-arm64, the relay and addon cases skip with a stated reason.
  • Live probe (M3): a copy of the real vendor runtime, run against a fake MAWS peer, got through the checked relay (tabs.create arrived) and nothing was refused.
  • Addon identity: diff of MAWS-wt-95/native/peer-auth/peer-auth.c and cua-wt-95/native/peer-auth/peer-auth.c prints nothing, and cmp of the two prebuilds prints nothing. SHA-256: 5c94d2b4… (source), 9de92f2c… (prebuild).
  • Reviews: milestones M1 and M3 by reviewer-medium, the whole branch by reviewer-high, all on opus. Every verdict was correct. Two P3 findings were fixed and re-reviewed:
    • the cua-remote skill's Node line (1fde3cf);
    • Node 23.0–23.6 lacking the flag (8350004).

Residue

  • SIGUSR1 in the vendor launcher. cua serve starts the vendor runtime under its bundled stock Node (cua_node/bin/node). That process opens an inspector on 127.0.0.1:9229 when it receives SIGUSR1, so any same-user process can run code inside the relay's admitted tree. Node accepts --disable-sigusr1 in NODE_OPTIONS, but launch.mjs strips NODE_OPTIONS and the vendor runtime stays unmodified (the spec owner's ruling), so nothing was applied. This would close only if the vendor's own launch gains the flag.
  • The Chrome-route host's socket keeps cua's Chrome-spec trust model. A same-user process is trusted there by decision, because its vendor client is not its descendant.

SSFSKIM added 25 commits October 9, 2026 17:49
…s to cua's client-mode relay, roots as process instances, peer re-read, eager load, packaged proof, the tracker row amended not closed
…amed, the engine stub for scene 7, no host-loss clearing, Linux skips, the sitting after the merges)
… the Interfaces, the anchor spawn's file, the SIGUSR1 residual's general form
… byte-identical to MAWS's, scripts/build-peer-auth.sh, node-api-headers, native/ shipped), the loader and policy in src/chrome/peer.mjs with Acceptance 1 and 2
…ss tree (runHost's authorize, pauseOnConnect, one refusal line per peer, fail closed without the addon), peerCheck in the status file, cua doctor's maws.hosts row and the maws_unreachable text, --disable-sigusr1 on the plugin's server and the runtime anchor with engines.node >=22.14, plugin 0.7.0, README For MAWS, Acceptance 7 tests
… README state Node 22.14, which the anchor's --disable-sigusr1 needs
…authentication spec (dated inline pointer and Decision Log entry; both sockets check the peer by ancestry, the Chrome-route host unchanged)
… lack --disable-sigusr1) in engines, the lockfile, the cloud-VM install condition, the README, the cua-remote skill and the cloud-VM README
…flag, main's startup window) in the Decision Log and the report
@SSFSKIM
SSFSKIM merged commit fb9db34 into main Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant