You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(remote): authenticate desktop and CLI tunnel connections - #31885
Desktop Orca and its CLI can connect to a manually configured secure tunnel that requires authentication headers. Desktop saves them in protected OS storage; the CLI reads an explicitly selected private file.
What Changed
Adds native server-menu controls for masked credential replacement and explicit clearing, plus optional headers during verified pairing. The host is verified and saved first; if credential storage fails, retry saves credentials without replaying the pairing link. Drafts reset when the secure origin or pinned host key changes.
All Node WebSocket constructors validate the secure origin, pinned host key and headers before dialing and refuse redirects. Desktop connection, status, subscription, browser-host and delegated phone-relay paths receive the same bound credentials. Credential mutations retire cached transports. Unreadable storage produces a failed status request without interrupting startup or transport retirement. Managed SSH/WSL paths remain separate.
CLI users set ORCA_REMOTE_AUTH_FILE to a bounded private JSON file, checked against the selected server. POSIX ownership/mode and native Windows DACL verification fail closed. Header values stay out of saved environment metadata, IPC status, pairing links and Orca authentication frames.
Tunnel authentication also follows the connections that replace a pairing code with a private device token. Credential deletion no longer blocks the app; a save made while deletion is pending is refused to protect newer values.
Why
Extends existing transports, secure-file writes, SecretStore and connection invalidation. No Cloudflare SDK, dependency additions or remote protocol changes. Explicit CLI file input avoids placing credential values in command arguments. Browser builds use browser authentication and do not expose native credential controls.
Linked Issue
Addresses #24709 for desktop and CLI authentication. This is partial scope; tunnel provisioning stays manual.
Stacked on #31880 while its mobile transport work is reviewed. First-time mobile pairing is #31886. The current shared base is 87f30cf; its changes will drop out after #31880 merges. Address validation is independently in #31499.
Visual Proof
Pending before/after capture of the native Add server and server-menu credential controls with synthetic, masked values. No physical device is available. The contributor permits review after automated checks pass, with native interaction behavior explicitly unverified.
Testing
November 11 review fixes, source commit f000955e2dec
Credential-only retry survives a failed server-list refresh without replaying a consumed pairing code. The CLI compares BigInt file IDs and nanosecond change times from the opened file and final path. The collision regression and all 25 focused credential-file and bounded-reader tests passed on macOS.
The final mobile safeguards are included. All 15 selected checks for that integration passed. All 22 static/type checks for the CLI follow-up passed. The broad related-unit selection exceeded its one-minute limit, so the complete changed gate remains incomplete.
Local validation uses upstream 4a31139c50b because the newer upstream commit introduced an unrelated renderer import error. The refresh preserves upstream source moves.
The final combined local checkout of #31499, #31880, #31885 and #31886 passed 3,860 mobile tests across 606 suites, 154 desktop/browser/file-reader tests across 23 suites, and all root and mobile production typechecks. The four sources merge together cleanly.
Fresh native builds, physical-device save/restart/background reconnect, native UI checks and live Cloudflare or Traefik acceptance are pending for these commits. Windows identity handling has a regression using synthetic colliding IDs. It has not been exercised on a Windows machine during this update.
The required upstream workflow for this source commit is awaiting maintainer approval. PR Checks run
Risk
Level: Medium. The riskiest boundary is binding protected desktop/CLI credentials to the correct paired server and retiring transports after credential changes. A regression could block remote access, keep a connection using old credentials or send credentials to the wrong endpoint. Mixed-version peers, SSH/WSL routing and browser header exclusion are preserved. Linux native-keyring and rendered UI acceptance remain unverified. Revert this PR to restore the previous transport; a revert does not delete saved credential files or revoke Cloudflare tokens. Clear credentials before rollback and revoke tokens separately.
AI Disclosure
Implemented with Codex (GPT-6) assistance. Independent read-only reviews were used during development. The review and test results above include their limits and do not constitute human maintainer approval.
Review
No new wire fields are sent to remote Orca peers. Credentials are bound and checked before each dial; encrypted envelopes cannot silently downgrade to plaintext or headerless access. Corrupt or mismatched stored credentials require explicit clearing before replacement.
Agent skill upstream boundary
Not applicable: no upstream skill-installer source or resources copied.
Notes
Tunnel creation remains manual under the approved scope. Browser Access-session acceptance and real-phone storage/reconnect remain distinct from these transport and protected-store checks. Validation-only workflows are on separate fork branches and are absent from this PR.
Checklist
Focused desktop/CLI authentication; before/after, mechanism and alternatives explained
Source reviewed for correctness, security and performance
Cross-platform, SSH/remote, folder-workspace and mixed-version behavior considered
Native UI visual proof attached
Fresh platform checks pass on the current source (earlier evidence linked above)
Exact-head upstream PR workflow passes before merge
Real-device and rendered UI acceptance (disclosed follow-up; contributor permits review without a device)
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Adds endpoint-bound authentication headers for secure WebSocket connections across desktop, mobile, and CLI flows. The changes include header validation, protected credential storage, pairing and connection routing, settings interfaces, and mobile diagnostics. Authenticated connections disable redirects. The Android WebSocket patch exposes redirect-control support and HTTP upgrade status. Documentation and tests cover credential handling and platform-specific behavior.
Merge Risk: Low · up to f3de1
Mobile users may be unable to edit or remove a host when the keychain is locked. Leaving the edit screen mid-save can require re-entering credentials after an address change. The CLI's Windows file-identity check has a narrow precision gap. None of these is severe, and each has a workaround, so the PR is mergeable once the owner is aware of them.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title clearly and concisely identifies the main change: tunnel authentication for desktop and CLI connections.
Docstring Coverage
Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description is mostly complete and follows the required structure. It explains the user impact, changes, rationale, linked issue, testing, risk, AI disclosure, security considerations, and rollbac…
Full details: Description check
Explanation
The description is mostly complete and follows the required structure. It explains the user impact, changes, rationale, linked issue, testing, risk, AI disclosure, security considerations, and rollback guidance. It clearly discloses that native UI proof, fresh platform checks, real-device testing, and some broad validation remain incomplete.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Cache edge-auth resolution on the terminal input path.
callRuntimeEnvironment resolves edge authentication before it uses the cached request transport. For direct wss:// environments, each terminal.send and terminal.updateViewport call can therefore perform synchronous credential-file I/O. Configured credentials also perform protected-storage decryption and parsing on the main process input path. This is more than a trivial nitpick.
Cache successful credentials and a missing-credentials result. Do not cache read or decrypt failures. Invalidate the cache after successful credential writes and clears, and during environment transport invalidation. Include the full pairing identity, including the device token. The cache key in the sketch must not omit that token.
Call forgetRuntimeEnvironmentEdgeAuth after successful writeRuntimeEdgeAuth and clearRuntimeEdgeAuth operations, or from invalidateRuntimeEnvironmentTransport. Preserve the existing remoteRuntimeConnectOptions call for cached credentials.
ℹ️ Review info⚙️ Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 3ee71b87-2680-4512-a845-464905d1e4ea
📥 Commits
Reviewing files that changed from the base of the PR and between 57f1fce and f338a464232ab9d834c29210847c7f0fdf4a6cc9.
⛔ Files ignored due to path filters: 1
mobile/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Addressed the performance note in the review summary in 72579369f5. Repeated connection resolution now caches validated credentials and missing-credential results by profile and full pairing identity, including the device token. Read/decrypt failures are not cached. Writes, clears and transport invalidation evict cached values; eviction occurs before file publication so a later durability failure cannot leave stale values. Binding checks still run before dialing.
The regression first observed 100 decryptions for 100 resolutions, then passed with one. A publication-then-error regression also failed before its fix. The affected 10 suites passed 76 tests; all four root typecheck projects, changed-code quality, lint and formatting passed. An independent review rechecked the cache edge case. The broad desktop test attempt did not produce a final result; the normal test wrapper also requires Bun, which is unavailable in this shell. Fresh three-platform validation is being dispatched.
The docstring-coverage warning is advisory; I kept comments to non-obvious behavior as required by this repository rather than adding redundant function descriptions. Upstream PR CI still requires maintainer approval.
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
🟡 Minor · Persist credentials after a committed endpoint update. · edit.tsx:167-172
mobile/app/h/[hostId]/edit.tsx:167-172 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Persist credentials after a committed endpoint update.
If the metadata write commits after the route revision changes, do not return before persistAuthChanges. Persist the captured headers, then re-prime and refresh the client. Guard setHost and all other UI updates with the revision check.
Suggested fix
- if (revision !== routeRevision.current) {- await reprimeHosts()- if (nextEndpoint !== undefined) {- refreshHostClient(host.id)- }- return- }-
// Retrying after a keychain failure must compare against the committed address.
- setHost({ ...host, personalName: nextName || undefined, endpoint: endpointEdit.endpoint })+ if (revision === routeRevision.current) {+ setHost({ ...host, personalName: nextName || undefined, endpoint: endpointEdit.endpoint })+ }
Update the pending-save test to expect writeEndpointAuthHeaders after leaving during the metadata write.
⚠️Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Share the edge-auth eligibility check between the resolver and the save handler.
The resolver decides which connections receive stored credentials. registerRuntimeEnvironmentEdgeAuthHandlers (saveEdgeAuth) decides which connections may store them. The two code paths use separate inline conditions. The resolver tests connectionDependency === 'ssh-tunnel'. The handler tests whether connectionDependency is truthy. The two conditions match today because the type has one value. They will diverge if a new dependency kind is added.
Export one predicate, for example isDirectSecureEdgeAuthEnvironment(environment), from this module. Use it in both places. Then a change to the eligibility rule applies to saving and sending together.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 198d9b8b-b9d9-4b0c-a513-3055d54ab108
📥 Commits
Reviewing files that changed from the base of the PR and between f338a464232ab9d834c29210847c7f0fdf4a6cc9 and 72579369f569a6eff7c38ebfd64c0e86d615d92b.
⛔ Files ignored due to path filters: 1
mobile/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
The suggested write after route cancellation would reverse the existing cancellation contract. Leaving or changing the route invalidates its revision. If the already-started metadata write later commits, the app re-primes the committed address and refreshes the client, but it does not start a new secret write from the canceled form. Existing credentials remain stored and bound to their original secure origin; they are not deleted or silently rebound. A changed endpoint can consequently need credential entry again. That is a recovery limitation, not a lost stored credential, and I am keeping this boundary rather than persisting canceled input.
The current regression does not start saving credentials after leaving during the metadata write explicitly covers that choice. I reran the host-edit and credential-store suites: 37 tests passed. The ordinary non-canceled path still saves headers after metadata and reports a storage-only retryable failure.
The proposed eligibility abstraction is an unverified future-proofing suggestion: connectionDependency is currently z.literal('ssh-tunnel').optional(), so the resolver and save handler have equivalent dependency checks. No current unsupported dependency bypass was identified. I have retained the focused implementation and existing eligibility tests.
All inline conversations remain resolved. Current upstream PR workflows still await maintainer approval; the successful clean job is separate from the required PR workflow.
The reason will be displayed to describe this comment to others. Learn more.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 68dc1724-3cfa-4619-a560-53e36421693e
Commits
Reviewing files that changed from the base of the PR and between 72579369f569a6eff7c38ebfd64c0e86d615d92b and f269fd9cb4080b64d79e4cca183c0f3eb71995ac.
Files ignored due to path filters: 1
mobile/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Invalidate transports on every replacement attempt, not only on success.
writeRuntimeEdgeAuth can publish new credentials to disk and then throw. The save handler skips transport invalidation on that path.
In src/main/ipc/runtime-environments/runtime-environment-edge-auth-handlers.ts, saveEdgeAuth calls writeRuntimeEdgeAuth(...) and then await invalidateTransport(environment.id) on the next line. If the write throws, the handler exits before invalidation. Open connections and subscriptions for that environment keep the headers they were built with. The disk now holds the replacement credentials. The user sees a save error and may assume nothing changed.
The consequence is narrow. Resolution reads the credential cache, which the store evicts before publication, so new requests read the new envelope. The stale state lasts only until existing connections reconnect. A retry that succeeds also invalidates transports.
The fix is to invalidate in a finally block. Invalidation on a failed attempt that wrote nothing only forces a reconnect.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: f627e89c-4139-4f46-9490-8c480570964b
Commits
Reviewing files that changed from the base of the PR and between bcf7fd880814991c7cb601e558acc531f1b44b32 and d8e103097e1aac50d37ddc8ad4d984a7a3171524.
Files selected for processing: 3
docs/site/content/docs/cli/reference.mdx
src/cli/runtime/remote-edge-auth-file.test.ts
src/cli/runtime/remote-edge-auth-file.ts
Files skipped from review as they are similar to previous changes: 2
src/cli/runtime/remote-edge-auth-file.test.ts
src/cli/runtime/remote-edge-auth-file.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
After a validated credential write throws, the handler now attempts to retire the environment's existing transports. It preserves the original storage error if retirement also throws or rejects. Successful writes still surface retirement errors. Invalid headers or stale pairing revisions continue to stop before storage or transport changes. The pairing path already retires transports when a credential-save failure returns a saved environment ID.
Three regression cases failed before the fix and pass now. The affected IPC/store/pairing suites pass 30 tests; the broader IPC/store/secure-file check passes 289 tests across 49 suites (two skipped). All four root type-check projects and the changed-code gate pass. Fresh macOS/Linux/Windows validation, including protected-store restart checks on macOS/Windows and the standard Node/Bun test selector, passed on matching product source: https://github.com/chunchet-ng/orca/actions/runs/40281387740 .
The upstream conflicts are resolved while preserving the new desktop chat-history APIs and moved disconnect handling. Independent review found no confirmed issue. Upstream required PR CI still needs maintainer approval.
Adapt Mark Hingston's native edge-auth work to current host lifecycles.
Bind credentials to the WSS origin so partial endpoint saves cannot
forward old credentials to a new host. Preserve the current E2EE flow.
Refs stablyai#24709
Source: stablyai#25077
Co-authored-by: Mark Hingston <[email protected]>
Android WebSockets forward custom headers across redirects. Disable both redirect modes for credential-bearing sockets and refuse credentials on Android clients without this native protection.
Build React Native from source so its patched module ships in Android apps. Preserve ordinary sockets and the existing E2EE flow.
Prefab 2.1.0 parses equals signs in patched dependency paths as options. Hash mobile package directory names so React Native source builds reach the compiler without changing dependency versions.
Guard the installed ReactAndroid source path with a regression test.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
Files skipped from review as they are similar to previous changes: 4
mobile/src/i18n/en-runtime-required.json
mobile/src/i18n/locales/en.json
mobile/src/components/host-edit-styles.ts
src/renderer/src/i18n/locales/en.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Desktop Orca and its CLI can connect to a manually configured secure tunnel that requires authentication headers. Desktop saves them in protected OS storage; the CLI reads an explicitly selected private file.
What Changed
Adds native server-menu controls for masked credential replacement and explicit clearing, plus optional headers during verified pairing. The host is verified and saved first; if credential storage fails, retry saves credentials without replaying the pairing link. Drafts reset when the secure origin or pinned host key changes.
All Node WebSocket constructors validate the secure origin, pinned host key and headers before dialing and refuse redirects. Desktop connection, status, subscription, browser-host and delegated phone-relay paths receive the same bound credentials. Credential mutations retire cached transports. Unreadable storage produces a failed status request without interrupting startup or transport retirement. Managed SSH/WSL paths remain separate.
CLI users set ORCA_REMOTE_AUTH_FILE to a bounded private JSON file, checked against the selected server. POSIX ownership/mode and native Windows DACL verification fail closed. Header values stay out of saved environment metadata, IPC status, pairing links and Orca authentication frames.
Tunnel authentication also follows the connections that replace a pairing code with a private device token. Credential deletion no longer blocks the app; a save made while deletion is pending is refused to protect newer values.
Why
Extends existing transports, secure-file writes, SecretStore and connection invalidation. No Cloudflare SDK, dependency additions or remote protocol changes. Explicit CLI file input avoids placing credential values in command arguments. Browser builds use browser authentication and do not expose native credential controls.
Linked Issue
Addresses #24709 for desktop and CLI authentication. This is partial scope; tunnel provisioning stays manual.
Stacked on #31880 while its mobile transport work is reviewed. First-time mobile pairing is #31886. The current shared base is 87f30cf; its changes will drop out after #31880 merges. Address validation is independently in #31499.
Visual Proof
Pending before/after capture of the native Add server and server-menu credential controls with synthetic, masked values. No physical device is available. The contributor permits review after automated checks pass, with native interaction behavior explicitly unverified.
Testing
November 11 review fixes, source commit
f000955e2dec4a31139c50bbecause the newer upstream commit introduced an unrelated renderer import error. The refresh preserves upstream source moves.The final combined local checkout of #31499, #31880, #31885 and #31886 passed 3,860 mobile tests across 606 suites, 154 desktop/browser/file-reader tests across 23 suites, and all root and mobile production typechecks. The four sources merge together cleanly.
Fresh native builds, physical-device save/restart/background reconnect, native UI checks and live Cloudflare or Traefik acceptance are pending for these commits. Windows identity handling has a regression using synthetic colliding IDs. It has not been exercised on a Windows machine during this update.
The required upstream workflow for this source commit is awaiting maintainer approval. PR Checks run
Risk
Level: Medium. The riskiest boundary is binding protected desktop/CLI credentials to the correct paired server and retiring transports after credential changes. A regression could block remote access, keep a connection using old credentials or send credentials to the wrong endpoint. Mixed-version peers, SSH/WSL routing and browser header exclusion are preserved. Linux native-keyring and rendered UI acceptance remain unverified. Revert this PR to restore the previous transport; a revert does not delete saved credential files or revoke Cloudflare tokens. Clear credentials before rollback and revoke tokens separately.
AI Disclosure
Implemented with Codex (GPT-6) assistance. Independent read-only reviews were used during development. The review and test results above include their limits and do not constitute human maintainer approval.
Review
No new wire fields are sent to remote Orca peers. Credentials are bound and checked before each dial; encrypted envelopes cannot silently downgrade to plaintext or headerless access. Corrupt or mismatched stored credentials require explicit clearing before replacement.
Agent skill upstream boundary
Notes
Tunnel creation remains manual under the approved scope. Browser Access-session acceptance and real-phone storage/reconnect remain distinct from these transport and protected-store checks. Validation-only workflows are on separate fork branches and are absent from this PR.
Checklist