Repository navigation
fix(web): pair and stay paired from plain-http LAN and Tailscale pages again (partial revert of #27540) - #29984
Conversation
…s again Partially reverts #27540 and the plain-http part of #27552, which broke web pairing on upgrade for 1.4.227 users who open Orca at a LAN or Tailscale address: - The host no longer refuses a first pairing from a plain-http page on another machine (insecure_origin, ORCA_ALLOW_INSECURE_WEB_PAIRING). - Such a page keeps its pairing code in local storage and signs in with it, as in 1.4.227, so reloads, new tabs and bookmarks stay paired; no notice. - Session-only browser keys (pairing.device-key-ephemeral.v1, the idle sweep) stay for browsers without Ed25519. - A web client whose credentials are refused shows the host's reason instead of an empty workspace and "Session restore failed".
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
ELI5
People who opened Orca's web client at their computer's LAN or Tailscale address (for example
http://100.x.y.z:6768/web-index.html) could no longer pair after upgrading from 1.4.227. The page loaded with no projects, "0 hosts" and a "Session restore failed" toast. This PR lets those pages pair again and keeps them paired across reloads, new tabs and bookmarks, as in 1.4.227.What Changed
Before: Orca refused the first pairing from a plain-http page on another machine unless the operator restarted Orca with
ORCA_ALLOW_INSECURE_WEB_PAIRING=1. The web client still started with no catalog, so the user saw "No workspaces found", "Add a project to get started", "0 hosts", and a sticky "Session restore failed / Changes won't be saved until restart" toast. The real reason only appeared in the browser console. Even with the opt-in set, a plain-http page kept the pairing only in memory, so any reload or new tab went back to "Connect to Orca".After: the same page pairs and lists the projects. A reload, a new tab, or opening the bookmarked URL keeps working.
Mechanism. This partially reverts #27540 (host) and the plain-http part of #27552 (browser):
mobile-socket-wiring.ts,ws-transport.ts,runtime-rpc-lifecycle.ts,mobile-e2ee-auth-validation.ts,e2ee-channel.ts): removes theinsecure_originrefusal, the per-socket Origin and marker bookkeeping it needed, and theORCA_ALLOW_INSECURE_WEB_PAIRINGopt-in. These files are back to their pre-feat(runtime): session-only browser keys and opt-in for pairing from plain-http pages (host) #27540 versions apart from the parts kept below.web-device-key.ts,web-runtime-credentials.ts,web-runtime-environment.ts,web-pairing-security-guidance.ts): a plain-http page on another machine is nowtoken-insecure-origin. It stores the pairing code in local storage and signs in with it, as in 1.4.227. The "This pairing lasts only while this tab is open" and "keeps a reusable pairing code" notices for that case are removed.pairing.device-key-ephemeral.v1, the 12-hour idle sweep, device-key sign-in). They still apply to secure pages and to browsers without Ed25519. The web bundle still adds?orca-client=webto its upgrade URL, and hosts ignore it. The browser still maps a sealedinsecure_originreply to its explanation, because hosts from v1.4.225 to v1.4.228 still send it.startup-web-pairing-refused.ts). It no longer shows the generic "Session restore failed" over an empty workspace.Credit: #27540 and #27552 added the session-only browser keys that this PR keeps.
Why
The refusal broke a workflow that worked in 1.4.227: LAN and Tailscale web access. It broke on upgrade, with no warning from the share flow (Settings still handed out the
http://<LAN/Tailscale IP>link it would then refuse), and with an error the user could not see. The plain-http hardening is being re-planned in the security tracker. Until then, behaving like 1.4.227 is the safe default. Alternatives considered:Linked Issue
N/A (user report from a release candidate; the re-plan is tracked in the security tracker).
Visual Proof
Same isolated build, web client opened at
http://100.108.226.109:<port>/web-index.htmlin headless Chromium.Before (origin/main):

After (this PR):

Testing
Live on macOS, with an isolated
--servehost from this branch (temporary profile and HOME, free port, two local git projects), driven by headless Chromium through Playwright:/web-index.html, still listed the projects.http://127.0.0.1, a secure context that uses device keys): pairs, survives a reload, and works from a new tab.Automated:
web-session-pairing.test.ts: a never-used code pairs over a direct socket, an already-paired browser keeps working, Relay pairing works, and the ephemeral-key registration, sweep and revoke tests still pass.web-insecure-origin-pairing.test.ts(new): on a plain-http page, a reload (fresh module graph) stays paired, signs in with the stored code, and shows no notice.startup-degraded-recovery.test.ts: a refused web client shows the host's reason, not "Session restore failed" (fails before the change).cross-version-web-upgrade-marker.unit.test.ts: the released host and this host both accept the marked upgrade from a LAN page.cross-version-web-session-pairing.unit.test.tspasses unchanged.pnpm tc, every step of the static-analysis job (including the max-lines and focus-read ratchets and the localization checks), and the unit folders around the changed files:src/main/runtime/{rpc,runtime-rpc*,device*,ephemeral*},src/main/server,src/renderer/src/{web,startup}.Mixed versions: no new opcodes or fields. An older web client against this host pairs as it did with 1.4.227. This web client against a v1.4.225 to v1.4.228 host still gets that host's refusal, and now sees it explained. Phones and desktop clients never hit the gate, so nothing changes for them.
AI Disclosure
Review
Codex (
gpt-6.1-sol, high): no findings.Agent skill upstream boundary
Notes
Security: this restores 1.4.227's plain-http behaviour on purpose. On such a page the reusable pairing code lives in the browser's local storage, as it did before #27540/#27552. Https and loopback pages keep non-extractable device keys. SSH: managed hosts serve and pair the same way. Windows and Linux: no platform-specific code is touched.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)