Repository navigation
Description
Why
Under ADR-0241, TLS on the Connect route ends at Cloudflare's edge. Cloudflare can therefore read every message, image, approval and secret exchanged between a phone or remote browser and the Host. Vain decided on 2026-10-21 not to accept that risk: Connect users get the same confidentiality that Tailscale users have. Connect has not shipped, so the protocol can still change.
#2541 blocks secrets on Connect in the meantime. This issue removes that block and protects everything else too.
Decided by Vain (2026-10-21): the phone drops the WebView full client
The phone's WebView full client loads its page code from the Host origin. Over Connect, that code crosses Cloudflare in plaintext and could be read or tampered with, so encrypting only the API calls would not be enough. Vain decided to remove the mobile full client entirely, on every route, not only on Connect. Everything the phone does goes through native screens over the encrypted channel.
Remove apps/mobile/src/ui/full-client-view.tsx, apps/mobile/src/host/full-client.ts, open-full-client.tsx, the /full-client route, their strings and apps/mobile/test/full-client.test.ts. Remove every entry point (paths as of main e6b367e5):
- Settings: the "Open the full client" row (
settings-view.tsx). - Chat page: the header button and overflow menu item (
conversation-screen.tsx). Also the private input card's "安全填写" (onFill→/full-client, kindprivate-input). It needs a native private input form that submits over the encrypted channel. - Routines page:
routine-screen.tsx(/full-clientfor a DM). - Activity / create menu:
shell/bottom-navigation.tsxopens/full-clientfor "new Bot" and "new Channel" on a Host. These need native flows, or are hidden until those exist.
Anything that only the full client offered today must either get a native screen in the same change or be listed as a known gap with Vain's sign-off. That includes the PersonaBot Computer and Browser viewers, which are proxied under /botharness-device/web/. Their WebRTC signaling must also run over the encrypted channel.
On the Host, once no client uses it, remove the gateway's cookie-authenticated /botharness-device/web/ path, the web session cookie and DEVICE_WEB_MUX_PATH. The ADR also amends ADR-0242's note that keeps that path.
Direction (to settle in a new ADR that amends ADR-0241)
Pin the Host key at pairing.
- The Host keeps a long-term X25519 identity key in the credentials service (machine-local and never in the repo).
- Its public key travels in the pairing link payload (ADR-0199 and ADR-0242) and in the account pairing offer.
- For account pairing (ADR-0241), the relay must not be able to swap the key. The offer is signed by the Host, or the phone shows a fingerprint for comparison. The ADR picks one.
Encrypt the session, not just fields. Over Connect, the client and Host run an authenticated key exchange against the pinned key, then carry the application stream as AEAD frames inside the existing HTTPS/WebSocket transport. Cloudflare sees only ciphertext and framing. Two candidate designs:
- Noise
IKorXKover theremote.muxWebSocket. All unary calls and attachment transfers move onto the mux whenever the route is Connect. This gives forward secrecy and one channel to audit. - HPKE (RFC 9180) with a sealed context per request. Simpler to bolt onto unary HTTP, but without forward secrecy.
The ADR picks one; option 1 is recommended. Libraries: @noble/curves and @noble/ciphers (pure JS: phone, browser and Node), or @hpke/core.
The Web Client remote chat (ADR-0242) is served by its own Host, so only its calls to the Remote Host need the channel. It uses the same shared apps/mobile/src/host/ client.
Bindings. Bind the transcript and AAD to hostId, the device ID and the route. Use a key exchange per connection, with no fallback to plaintext once a Host has advertised the capability. A Host on Connect refuses plaintext application calls.
Unchanged. Pairing credentials, revocation, content-free push (ADR-0202) and the Tailscale and loopback routes. Those routes may skip the extra layer.
Deliverables
- ADR (amending ADR-0241 and ADR-0242) with:
- the decisions above;
- the full client removal and the list of affected flows;
- a threat model covering Cloudflare as a passive or active adversary, a compromised relay, a stolen Host key and a stolen phone.
- Remove the mobile full client and its entry points, adding native replacements (at least the private input form).
- Tracer bullet on the ADR-0241 rig: a phone over Connect opens a DM, sends an image, approves a tool call and submits a private input natively. A capture at the
cloudflaredorigin listener shows no plaintext. - Remove the Connect: refuse secret-bearing calls on the Connect route until it is end-to-end encrypted #2541 refusal once the phone and the Web Client remote chat both use the channel.
- CLI parity:
deepseekbot connect statusreports whether the channel is encrypted and the Host key fingerprint.
Reported by Vain.
Additional acceptance — adopted remote-transport research (2026-10-22)
Human approved these contract clarifications after reviewing ds-harness-remote at 28a2da05. Preserve this issue's existing implementation, chosen protocol, ADR and recorded evidence; this is not a request to restart crypto selection, replace the current owner or add a second device trust store. Already-covered items can point to exact-source tests and qualification evidence; missing coverage stays explicit.
- Document how the existing pairing ceremony binds the intended Host/device to their keys, including first enrollment and account pairing. Later key pinning alone does not prove that the relay cannot substitute a key on first enrollment; do not weaken the existing Host-key verification requirement to automatic trust of a server descriptor.
- Each fresh authenticated channel binds the intended Host, admitted device, protocol/route context and connection identity or equivalent fresh transcript generation. Stale channel messages, mismatched identity and key substitution are rejected before application effects; route/reconnect does not create new trust or revive a revoked device.
- Endpoint-level negative tests cover tampering and replay, including replay after reconnect. Ensure hostile ciphertext reaches the receiving endpoint instead of attributing an outer relay rejection to cryptographic protection; assert no accepted application effect. Fixed vectors are useful contracts, not an independent security audit or proof of interoperability by themselves.
- Keep encryption/counter advancement and transmission correctly ordered under concurrent sends, with explicit bounded queued bytes/messages, in-flight work and reassembly where present. Slow consumers, overload, close/revoke and channel replacement clear only owned resources and produce coded refusals without plaintext fallback.
- Publish ready only after authenticated handlers and cleanup ownership are installed. Connection resources and delayed callbacks are scoped to their concrete instance; reconnect cannot replay uncertain mutations or silently redirect a remote operation to the local Host.
Video consumers in Spec #2555 / T6 #2563 inherit these guarantees and add actual media-revocation evidence. The carrier does not become a video relay. No change to this issue's implementation claims, PR ownership, release status or existing dependencies is implied.
Integration evidence and remaining qualification (2026-10-22)
The additional carrier contracts above are covered by the integration report, receiving-gateway regressions and the existing ADR-0244 trust ceremony. These checkmarks do not claim an external audit or production/device qualification.
Vain explicitly approved merge before integrated Simulator QA, so the following checks are follow-up acceptance for the shared main-branch batch, not merge blockers. Keep their status explicit and add actual screenshots to the merged PR body afterward:
- Complete the native DM → image → real tool approval → private-input tracer on the integrated candidate, with correlated outer-channel and Host evidence. Prior iOS password/pairing receipts remain valid for their recorded sources, but do not prove this entire sequence.
- Qualify deployed account enrollment through the independent Host comparison and exact device-key approval ceremony.
- Record remaining Android/physical-iPhone and assistive-technology/Chinese-rendering coverage separately; no device result may be inferred from static checks or Simulator evidence.
Connect Browser/Computer remains explicitly disabled pending its separate qualification (#2563). Independent cryptographic audit/cross-implementation qualification and coordinated rollout remain release concerns; code merge does not constitute deployment.
Final acceptance — completed 2026-10-22
Shared Simulator Batch53 verified matched main46bb44b2 Before and integrated ea36821 After on the existing QA iOS27 dev client. The actual native DM → photo → tool approval → private-input tracer passed after fixing React Native Blob byte reading in #2578, merged as4de4982443d501af9b68372848bc7fec36f7d7c4 with explicit Human authorization. Full CI39739723972 and CodeRabbit passed.
HTTP502, malformed-handshake and exact-device-revocation failures refused the native password submission without plaintext fallback; canonical requests stayed pending. Explicit successful recovery cleared the form. The instrumented real Cloudflare tunnel captured2,524 records/51 channel upgrades with no synthetic secrets/application markers and fallback0;2 deliberate plaintext probes returned404.
Formal deployed same-account enrollment passed after separately Human-authorized relay update toebedbe4d-8b7c-42ce-bb68-5d8dcb630fa7. Full Host fingerprint was independently compared; only the exact phone key was approved. Native Settings loaded over the managed tunnel with Host state encrypted, unchanged App PID4008 and no cold restart. The legacy relay incompatibility was observed as refusal before trust, not a plaintext fallback.
Final report and coverage limits. Actual before/after, password failure and account-pairing screenshots are embedded in #2547 and #2578. Temporary task Host/tunnels/keys/credentials/fixtures were cleaned and the shared device lease released; existing device and original connection preserved.
Android, physical iPhone, VoiceOver, CJK rendering, external cryptographic audit and cross-implementation qualification are explicitly not covered by this Simulator acceptance. Browser/Computer remains disabled under #2563; app release qualification stays with its release owner. These separate limits do not reopen the completed native tracer and account-enrollment checks above.
Activity
DoodleBears commentedon Oct 21, 2026
Agent work claim
codex/local/01a15f6b-a5c1-7db2-b5b1-a33a1153fbc6(not a DSH Session)codex/2541-connect-secret-safetyDoodleBears commentedon Oct 21, 2026
Agent work continuation
codex/local/01a15fc3-2dc9-7e13-a9c5-8ca7f162d141(not a DSH Session)codex/local/01a15f6b-a5c1-7db2-b5b1-a33a1153fbc6at the Human's explicit continuation request; the prior chat ended interrupted following authentication failures.codex/2541-connect-secret-safetyDoodleBears commentedon Oct 21, 2026
Agent work scope update — Track B approved
codex/local/01a15fc3-2dc9-7e13-a9c5-8ca7f162d141codex/2542-connect-noise-xk; base:codex/2541-connect-secret-safety(fix(connect): refuse secret entry and retire the phone full client #2546).test(connect): record encrypted private-input web evidence
fix(connect): align fingerprint confirmation and encrypted-route tests
DoodleBears commentedon Oct 21, 2026
Agent work outcome — handed off for review
codex/local/01a15fc3-2dc9-7e13-a9c5-8ca7f162d141. State: handed-off. This closes this task’s active implementation claim and its superseded predecessor claim, not the issue.16d4e6450cde95ea8c1f44953806577d0bdeb8e9, based on Track A fix(connect): refuse secret entry and retire the phone full client #2546 atb842d3ce0750b5085106defef21c4d4eb0112f81.DoodleBears commentedon Oct 21, 2026
Agent work resumed — Expo CI repair
codex/local/01a15fc3-2dc9-7e13-a9c5-8ca7f162d141. State: active.codex/2542-connect-noise-xk), based on fix(connect): refuse secret entry and retire the phone full client #2546. No SDK major upgrade, deployment or merge.fix(mobile): align Expo SDK 58 patch dependencies
DoodleBears commentedon Oct 21, 2026
Agent work outcome — Expo CI repair complete, handed off
codex/local/01a15fc3-2dc9-7e13-a9c5-8ca7f162d141. State: handed-off; resumed Expo repair scope completed.52d6ef5e60e9a3d904970acd1f36d4005dd5174a, still based on fix(connect): refuse secret entry and retire the phone full client #2546 (codex/2541-connect-secret-safety). No merge, release or deployment.34 remaining items
DoodleBears commentedon Oct 22, 2026
Agent work resumed — main Simulator acceptance
codex/local/01a15fc3-2dc9-7e13-a9c5-8ca7f162d141; state active.DoodleBears commentedon Oct 22, 2026
Main Simulator Batch52 completed on
55e0ce95200faf2cfc9a20ec4d41acc24be15c9a, reusing the existing QA iOS27/client. Pinned report; eight actual screenshots now embedded in merged PR #2547 (exact body readback + PNG200 verified).ea36821ea92904260ba3d78d21db84a3a7d60b13includes newer main and passes full CI39739723972; native recheck awaits the next owner-cut batch. The complete native tracer therefore remains unchecked.Batch52 resources cleaned and lane explicitly RELEASED; original device, My Mac pairing and ten photos retained. #2542 remains open pending acceptance, with no release/deployment claim.
fix(mobile): read native blobs before encrypted uploads (#2578)
DoodleBears commentedon Oct 22, 2026
Agent work outcome
codex/local/01a15fc3-2dc9-7e13-a9c5-8ca7f162d141fix(connect): refuse secret entry and retire the mobile full client
merge: preserve remote cards and safety with current remote activity
feat(connect): encrypt paired device traffic with pinned Noise XK
fix(connect): close review gaps in flow control and lifecycle
fix(connect): stop fallback after encrypted HTTP errors