feat(host): strip client identity and enforce the public route policy
Stacked on #3271. Please review only the top three commits.
Summary
Host's identity handoff and public route policy (ADR 0021 §6).
Host drops every identity a client claims and sends the credential's principal to the daemon as x-agent-device-principal. The daemon reads that header only on a request that holds the daemon token, and treats it as an attested tenant. The contract is proposed in #3264.
The policy runs through a new optional admitRpc proxy hook, after the proxy has authenticated the request, so Host never repeats the proxy's auth or body handling. Plain proxy sets no hook. Host returns 403 with a typed reason for:
- macos-app allocation;
- any input naming a Host path, batch steps included, using each command's schema;
allowDownload;replayandtest, whose nested actions it can't check.
/admin/* isn't served at all, and anonymous /health is minimal.
Closes #3266. 21 files, 943 gross lines vs #3271. http-server.ts grows only by call sites here; #3274 brings it back under 1,000 lines.
Validation
Tested commit 784bd9393:
pnpm check:affected --run: all pass except a flakyaffected-selectortest (ENOTEMPTY on temp cleanup; unchanged from main). The 17 checks after it pass when run separately.pnpm check:daemon-wire-compatpassed. The protocol is unchanged.- Tests cover each §10.6 spoofing case, plus every bypass a review found: URL and
..positionals, a fake upload id, batch steps,trace/pushpaths,launchConsole, and planted/tmpfiles.
No device-facing change.