remote relay: permit scoped terminal paste - #14915
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. Review configuration: ⚙️ Run configurationConfiguration used: Repository: manaflow-ai/cmux/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
All contributors have signed the CLA ✍️ ✅ |
|
Security note on relay equivalence with
Tests in this PR cover the owned-surface allow, foreign-surface deny, missing/malformed field deny, arbitrary 🤖 Generated with Claude Code |
# Conflicts: # Packages/macOS/CmuxRemoteWorkspace/Sources/CmuxRemoteWorkspace/Relay/RemoteRelayAuthorizationPolicy.swift
Adds RemoteCLIRelayPolicyTests coverage for the reviewed terminal.paste relay contract: an owned surface with submit_key none or return is forwarded, and command-bearing params, window fallback selectors, arbitrary submit keys, missing submit_key, non-string text, and malformed surface IDs are denied before reaching the local socket. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Dogfood build of cmux DEV pr-14915-e6d813f6.app The link opens this exact commit in the cmux dev menu bar app. The build starts on each push and the page waits until it is ready; a newer push replaces it. It signs in against production, so Cloud or backend changes still need a tagged build with a development backend. Dogfood tours of
|
CI failure attributionCI failed on Not re-run automatically: only gate jobs failed. Written by |
|
Pending security and product review of scoped remote terminal paste, plus a manual rebase onto current main. — Oolong g1 🌾 |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
FYI: the scoped relay contract and the “Relay authorization analysis (GHSA-9vmv-3hjw-j28c)” section remain as written. |
|
Merge receipt for
Labeled |
0906bcb fix: make main's full test suite pass again (manaflow-ai#16429) 11bfe00 Restore custom sidebar preview gallery (manaflow-ai#16535) 343dd1b web: sync all Hexclave webhooks into a validated, order-independent mirror (manaflow-ai#16339) 00547d5 ci: avoid blaming unrelated merges for compile failures (manaflow-ai#16533) b782440 fix(ci): provision Go for every iOS Release archive (manaflow-ai#16534) 3555618 Add a Jump to Bottom button to terminal panes (manaflow-ai#15382) 79febcf fix: tolerate delayed App Store Connect processing (manaflow-ai#16527) fcbf13c fix: export Foundation for remote paste policy (manaflow-ai#16525) 6d86537 Add What's New recap with an off / quiet / sheet setting (manaflow-ai#14876) 256d964 fix(xcstrings): keep conflict resolutions valid JSON (manaflow-ai#16071) 8473bdc fix: upload pasted images into private SSH directories (manaflow-ai#16523) 53c705c Show opt-in model, context %, and estimated cost next to agent status in the sidebar (manaflow-ai#14855) eba3c42 remote relay: permit scoped terminal paste (manaflow-ai#14915) e447665 fix: stop update relaunch prompts from looping (manaflow-ai#15702) 4a46320 Fix Cloud paid team limits for ID-only selected teams (manaflow-ai#16318) c266af9 test(cloud): pin the CLI tree's link error message through the bundled CLI (manaflow-ai#16515) 0059066 Calmer focus feedback: one short pulse, no flash while typing (manaflow-ai#14894) 65930fc fix(remote): preserve tmux split metadata (manaflow-ai#16398) 512817d docs: fill missing unreleased user-facing changes (manaflow-ai#16519) f204ade ci: nightly 120 Hz fling bench for the cmux-next agent pane (manaflow-ai#16511) 2be3b26 Remove generated custom sidebar preview art (manaflow-ai#16518)





Summary
Implements #14910.
cmux paste --submitalready uses the right terminal path for multiline agent prompts, butterminal.pastewas intentionally absent from thecmux sshrelay schema.This adds it with a narrow remote contract:
No window/focus fallback, arbitrary submit key, new shell command, or generic mobile RPC authority is added.
Authorization
The existing two relay gates remain authoritative:
terminal.pastenow participates in both.The app-side dispatch gate re-captures the current remote topology before execution, so a moved/retired/localized surface loses paste authority just like
surface.send_text.Relay authorization analysis (GHSA-9vmv-3hjw-j28c)
Method added to the relay allowlist:
terminal.paste, paramsworkspace_id,surface_id,text,submit_key.surface.send_textalready reaches. It does not spawn or respawn terminals, open URLs, or run scripts. The text goes through Ghostty's paste encoder, which replaces unsafe control bytes (including ESC and DEL) with spaces and wraps the payload in bracketed-paste fences, so it can carry less thansend_text, which writes raw bytes.submit_keyis limited tononeorreturn;returnis the same Enter thatsend_textcan already send as\r.workspace_idandsurface_idare required, both are existing scoped selector keys, and there is no window or focus fallback.RemoteRelayAuthorizationPolicydenies a surface outside the owner workspace, and the dispatch gate re-captures topology so a moved, retired, or localized surface loses authority. No new ID param names are introduced.Command-bearing params (
command,initial_command,tmux_start_command,pane_start_command, ...) remain denied for this method, as do unknown keys such aswindow_id.Policy tests:
RemoteCLIRelayPolicyTests: owned surface forwarded withnoneandreturn; denied withcommand,initial_command,window_id,submit_key: ctrl+enter, missingsubmit_key, non-stringtext, and a malformedsurface_id, none of which reach the local socket.RemoteRelayAuthorizationPolicyTests: owned surface allowed, foreign surface denied, arbitrary submit keys denied.RemoteRelayCoreRPCPolicyTestsandRemoteRelayTmuxCompatAuthorizationTests: syntax, capability discovery, and revocation after the surface leaves the relay topology.Submit semantics
Remote relay callers can request only:
none— paste onlyreturn— let the existing terminal handler select/send the agent-aware submit keyThey cannot supply an arbitrary key chord through this method.
The existing paste handler still owns:
Tests
Adds package-level coverage for:
Adds app-level relay coverage for:
Docs
Updates the CLI contract:
cmux pasteremains local by default and is available through an authenticated remote workspace only under the exact scope above.Draft until package/app CI and an end-to-end
git diff | cmux paste --submitcheck inside acmux sshworkspace pass.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Permits
terminal.pastethrough thecmux sshrelay for authenticated remote workspaces, scoped to an exact owned surface andsubmit_keyofnoneorreturn. Previously paste was blocked on the relay; remote callers can now paste but cannot use fallback selectors or arbitrary submit keys.terminal.pasteto both relay policies and the routing schema; the app-side dispatch gate re-captures remote topology so moved or retired surfaces lose paste authority.Written for commit 06b19e5. Summary will update on new commits.