Skip to content

Narrow what a relayed machine stream can reach - #6769

Merged
hurttlocker merged 1 commit into
mainfrom
fix/machine-attach-hardening
Nov 25, 2026
Merged

hurttlocker merged 1 commit into
mainfrom
fix/machine-attach-hardening

Conversation

@hurttlocker

Copy link
Copy Markdown
Collaborator

What changes

Machine attach stays off by default. While it is on, a relayed stream can now reach much less.

Route and method allowlist

  • A web-machine stream replays only GET and HEAD of the desktop-app notice pages (/, /mobile, /dashboard), /icon.png, /favicon.ico and /_next/static/* (webMachineRouteAllowed).
  • Every other route or method, and encoded path tricks, get 403 web_machine_route_forbidden and never reach the local server.
  • These are the pages the website frames today.

No operator credential on replay

  • Replays carry no credential. Any Authorization in the relay frame is dropped, and the local operator token is no longer attached. The allowlisted pages need none, so the narrowest token for the stream is no token.
  • The response scan for the operator token stays.
  • The connector no longer opens a loopback /ws socket with the operator token for a relayed stream; realtime frames are dropped.
  • authorizationOverride is removed from the shared replay helper, since nothing uses it now.

Plugin streams refused

  • Plugin grants arrive from the relay as plain claims (client, scopes, account, expiry) that the Mac cannot verify.
  • A mux-open with surface: "plugin" is now answered with mux-close 4403 plugin_grant_unverifiable, and nothing is replayed for it.
  • src/lib/connect/plugin-relay.ts is deleted. The local plugin route and its locally minted capability are unchanged.

To re-enable plugin streams, the account service needs to sign each grant with a key the Mac pins. The signature should bind the account, machine, client, scopes, relay stream id and a short expiry, and the Mac should verify it before it mints its local capability.

Docs: docs/internals/connect-contract.md and docs/operations/browser-console-removal.md now describe the narrowed surface.

Tests

  • src/lib/connect/machine-attach.test.ts:

    • over a real relay socket, page and static reads are replayed with no Authorization header;
    • an API read, a POST and an encoded traversal get 403 without a fetch;
    • a realtime frame opens no local socket.

    Against main's connector these fail (operator bearer attached, loopback socket opened).

  • src/lib/connect/machine-full-surface.test.ts, through the reference relay and its cookie-authenticated web edge:

    • documents and large assets still render;
    • /api/panel/ws-info is refused before the local server;
    • no local realtime socket opens;
    • a machine drop still closes the browser with 1012.
  • tests/plugin-relay-real-path.test.ts: a plugin mux-open gets the 4403 close and a request on that stream reaches nothing. It fails on main, where the stream is served.

  • tests/plugin-front-door-real-path.test.ts and tests/plugin-task-draft-real-path.test.ts now mint the local plugin capability directly, since the relay grant path is gone.

  • npm run typecheck:fast, npm run verify:ci.

🤖 Generated with Claude Code

A web-machine stream now replays only GET and HEAD of the notice pages and
static files, carries no local credential, and opens no loopback realtime
socket. Plugin streams are refused because their grants arrive as plain
claims the Mac cannot verify.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the size/L Pull request with L diff size label Nov 24, 2026
@github-actions

Copy link
Copy Markdown

📝 o8.run docs may need updating

This PR changes source that the public docs describe. Review whether these pages are still accurate (and bump their stamp in o8-site if so):

Flagged by docs-drift against https://o8.run/api/docs/manifest. Docs only — nothing is auto-edited.

@github-actions

Copy link
Copy Markdown

🔍 PR Review Bot

Metric Value
Files changed 11
Additions +216
Deletions -508
New files 0

Automated review — CI workflow

@hurttlocker
hurttlocker added this pull request to the merge queue Nov 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 24, 2026
@hurttlocker hurttlocker added the tests-removed-ok Human-reviewed: test deletions/assertion loss are intentional label Nov 25, 2026
@hurttlocker
hurttlocker added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit adca656 Nov 25, 2026
34 of 35 checks passed
@hurttlocker
hurttlocker deleted the fix/machine-attach-hardening branch November 25, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Pull request with L diff size tests-removed-ok Human-reviewed: test deletions/assertion loss are intentional

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant