Skip to content

feat(mobile): authenticated custom endpoints for direct connections - #25077

Closed
mhingston wants to merge 10 commits into
stablyai:mainfrom
mhingston:mobile/endpoint-auth-headers-24709
Closed

mhingston wants to merge 10 commits into
stablyai:mainfrom
mhingston:mobile/endpoint-auth-headers-24709

Conversation

@mhingston

@mhingston mhingston commented Oct 3, 2026 •

Copy link
Copy Markdown

ELI5

If your Orca desktop sits behind a tunnel that asks for its own login (like Cloudflare Access), the phone app previously had no way to present those credentials, so the connection died at the tunnel edge. Now you can save those edge credentials per host on the Edit-host screen, and the app sends them with the connection handshake.

What Changed

Before: tapping a host behind an authenticated tunnel failed (HTTP 401/403 at the edge) with no way to supply edge credentials; the only paths were an open tunnel, relay, or VPN.

After: Edit host has an Edge authentication section (header name + secret value rows). Saved headers attach to the direct WebSocket handshake for that host, including reconnects and endpoint probes (which dial through the same client).

Mechanism: per-host header bundle in SecureStore via the existing pairing-keychain machinery (orca.mobile-endpoint-auth.<hostId>, zod-validated, RFC 9110 names, max 8); primed to memory at host-open and threaded ConnectOptions -> DirectRpcClient -> RpcClientSocketFactory -> RpcClientSocketSession into React Native's WebSocket(url, protocols, { headers }); header names (never values) in open logs; cleared with the rest of the host credentials on unpair. Web is structurally excluded (no-op store sibling, browsers cannot set handshake headers anyway).

Why

Fixes #24709. Custom headers (option 1 in the issue) cover Cloudflare Access service tokens and any header-based edge auth without Orca becoming Cloudflare-specific. Alternatives considered: stuffing credentials into pairing URLs (rejected in the issue — secrets must not travel in links/QR), and query-param tokens (many edges only accept headers, and URLs get logged).

Linked Issue

Fixes #24709

Visual Proof

Edit Host

image

Network diagnostics

image

Testing

  • Manually verified logic paths locally (validation, storage round-trip, socket construction) via the new tests
  • Automated tests added: endpoint-auth-headers.test.ts (validation, log redaction, snapshot cache), endpoint-auth-headers-store.test.ts (keychain round-trip, host mismatch, corrupt payloads, fail-closed prime), rpc-client-socket-headers.test.ts (headers reach the handshake, plain sockets unchanged, values never logged)
  • mobile: typecheck, tests-typecheck ratchet, full src/transport suite (1207 passed), oxlint, and check:code-quality:changed all pass

AI Disclosure

Implemented with AI coding assistance (OpenCode agent).

Notes

Security: values live only in SecureStore (WHEN_UNLOCKED_THIS_DEVICE_ONLY) and process memory; pairing links, QR codes, connection logs, and diagnostics carry names at most. Cross-platform: native-only by construction; web resolves no-op siblings. Backwards compatible: hosts without headers dial exactly as before.

Allow per-host edge-auth headers (e.g. Cloudflare Access service
tokens) on direct WebSocket dials. Headers live in SecureStore,
never in pairing URLs, and only header names reach logs.
Copilot AI balanced review requested due to automatic review settings October 3, 2026 20:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Credential handling can erase saved secrets or transmit them unencrypted, and lifecycle and route regressions remain unresolved.

Review effort: Balanced
Findings: 3 High severity · 4 Medium severity

Open (7)
What changed in this PR

Adds per-host edge authentication for Orca Mobile’s direct connections, enabling header-protected tunnels without putting credentials in pairing links.

Changes:

  • Adds editable authentication headers backed by secure storage.
  • Passes saved headers into direct WebSocket handshakes.
  • Adds validation, storage, handshake, and log-redaction tests.
File Description
mobile/​src/​transport/​unpaired-host-credential-deletion.ts Deletes headers when unpairing.
mobile/​src/​transport/​settings-host-client-lifecycle.test.ts Mocks credential priming.
mobile/​src/​transport/​rpc-client.ts Adds header connection options.
mobile/​src/​transport/​rpc-client-socket-session.ts Supports custom socket construction.
mobile/​src/​transport/​rpc-client-socket-headers.test.ts Tests handshake headers and redaction.
mobile/​src/​transport/​rpc-client-socket-factory.ts Creates authenticated sockets.
mobile/​src/​transport/​mobile-endpoint-lifecycle.ts Supplies headers to direct connections.
mobile/​src/​transport/​host-open-recovery.test.tsx Mocks credential priming.
mobile/​src/​transport/​host-logical-client.ts Supplies cached host headers.
mobile/​src/​transport/​host-entry-opener.ts Loads credentials before connecting.
mobile/​src/​transport/​endpoint-auth-headers.ts Validates and caches headers.
mobile/​src/​transport/​endpoint-auth-headers.test.ts Tests validation and caching.
mobile/​src/​transport/​endpoint-auth-headers-store.web.ts Provides no-op web storage.
mobile/​src/​transport/​endpoint-auth-headers-store.ts Stores credentials securely.
mobile/​src/​transport/​endpoint-auth-headers-store.test.ts Tests credential storage behavior.
mobile/​src/​transport/​direct-rpc-client.ts Forwards headers and extracts request wiring.
mobile/​src/​transport/​direct-request-pipeline.ts Groups request and stream initialization.
mobile/​src/​transport/​client-context.test.ts Mocks credential priming.
mobile/​app/​h/​[hostId]/​edit.tsx Loads and saves authentication settings.
mobile/​app/​h/​[hostId]/​edge-auth-headers-section.tsx Adds header editing controls.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

return { id: `edge-auth-${nextRowId}`, name: '', value: '' }
}

export function EdgeAuthHeadersSection({

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — moved to mobile/src/components/edge-auth-headers-section.tsx (route-boundary test passes). The row factory moved with it.

Comment thread mobile/app/h/[hostId]/edit.tsx Outdated
Comment on lines +72 to +74
try {
const stored = await readEndpointAuthHeaders(found.id)
const entries = stored ? Object.entries(stored) : []

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — the seed now matches normalized blank rows, and an auth-read failure routes to the load-error screen with the form blocked, so an unread baseline can never enable a destructive save.

export function createEndpointAuthSocket(url: string, headers: EndpointAuthHeaders): WebSocket {
// Why Reflect: the DOM lib type only knows the two-arg constructor, so the third arg cannot be
// written directly; React Native's runtime WebSocket accepts (url, protocols, { headers }).
return Reflect.construct(WebSocket, [url, undefined, { headers }])

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed both layers — the editor blocks saving headers against a non-wss endpoint, and the dial path drops headers for ws:// with a values-free warning log instead of sending cleartext. Headerless ws:// still dials as before.

error: string | null
onRowsChange: (rows: EdgeAuthRow[]) => void
}) {
return (

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — section renders only when Platform.OS is not web; the web store sibling stays a no-op so browser clients can never hold secrets.

Comment thread mobile/app/h/[hostId]/edit.tsx Outdated
Comment on lines +151 to +153
await deleteEndpointAuthHeaders(host.id)
} else {
await writeEndpointAuthHeaders(host.id, authNormalized.headers)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — metadata commit and header commit are separate steps now. A header failure keeps a static error on screen (never a keychain message) while an endpoint move still refreshes the live client, so no partial state goes unnoticed.

Comment thread mobile/app/h/[hostId]/edit.tsx Outdated
<Text style={styles.previewError}>{endpointEdit.error}</Text>
) : null}

<EdgeAuthHeadersSection

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — that test now selects Name/Address by label and has a second case covering the header name/value controls and Add-header behavior.

recordConnectionClientSessionStart(hostId)
// Why: SecureStore reads are async but the dial path is sync — prime the
// in-memory snapshot here so every socket this client opens carries it.
await primeEndpointAuthHeaders(hostId)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — the opener rechecks ticket, demand, and published entry immediately after priming, before constructing the client, so cancelled opens never dial.

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

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.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0673a25b-795c-40f5-b8da-9842c07bd87c
📥 Commits

Reviewing files that changed from the base of the PR and between a925e75 and a78a90c.

📒 Files selected for processing (5)
  • mobile/src/transport/endpoint-auth-headers-store.test.ts
  • mobile/src/transport/endpoint-auth-headers-store.ts
  • mobile/src/transport/endpoint-auth-headers.ts
  • mobile/src/transport/host-removal-lifecycle.test.ts
  • mobile/src/transport/host-removal-lifecycle.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The change adds mobile endpoint-authentication header editing, validation, keychain storage, and WebSocket handshake support. It primes stored headers before host connections and clears stored or cached headers during host cleanup. The host edit screen saves authentication changes and refreshes the client when needed. The change also extracts direct request tracker and stream registry construction into a shared pipeline factory.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to a78a9

Endpoint authentication headers are validated, stored securely, sent only on secure WebSocket connections, and cleared when a host is removed. No outstanding issue blocks merging.

Architecture Summary

Architecture risk: 🟡 Medium · up to a78a9

The change affects 1 system.

Changed systems: mobile

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — mobile (service) was modified; 26 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in mobile/src/transport/client-context.test.ts: Added a mock for ./endpoint-auth-headers-store whose primeEndpointAuthHeaders function resolves to null.
  • observed — Modified behavior in mobile/src/transport/host-logical-client.ts: Added the peekEndpointAuthHeaders import from ./endpoint-auth-headers.
  • observed — Modified behavior in mobile/src/transport/host-logical-client.ts: connect now receives edgeAuthHeaders from peekEndpointAuthHeaders(host.id) in addition to onLog; the previous call supplied only onLog.
  • observed — Modified behavior in mobile/src/transport/mobile-endpoint-lifecycle.ts: Imports peekEndpointAuthHeaders for use when opening a direct endpoint connection.

Reliability and maintainability

  • inferred — Risk-relevant change factors for mobile: blast_radius_3; direct_dependents_3
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR adds createDirectRequestPipeline and changes DirectRpcClient to construct its request tracker, stream registry, and ID generator through it. The new helper only consolidates tracker and reg… Remove the createDirectRequestPipeline extraction, its DirectRpcClient refactor, and its unrelated test, or establish a concrete connection between them and the endpoint-authentication requirement.
Docstring Coverage ⚠️ Warning Docstring coverage is 25.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 39 functions across 28 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #24709 requests provider-neutral authentication for existing mobile direct endpoints. The PR adds per-host header editing and SecureStore persistence, primes headers for direct connections, and …
Title check ✅ Passed The title clearly and concisely identifies the main change: adding authenticated custom endpoints for mobile direct connections.
Description check ✅ Passed The description explains the user impact, implementation, motivation, linked issue, security and compatibility considerations, and reported tests. It includes visual proof, but does not clearly show b…
Full details: Out of Scope Changes check

Explanation

The PR adds createDirectRequestPipeline and changes DirectRpcClient to construct its request tracker, stream registry, and ID generator through it. The new helper only consolidates tracker and registry wiring; it does not implement or support issue #24709's endpoint authentication requirement. The associated pipeline test also covers this unrelated refactor.

  • Fix all pre-merge checks with AI
  • Autopilot · 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 045082c9-f2d9-443a-91dd-151fe69a2b9e
📥 Commits

Reviewing files that changed from the base of the PR and between 752871b and 041d9b0.

📒 Files selected for processing (20)
  • mobile/app/h/[hostId]/edge-auth-headers-section.tsx
  • mobile/app/h/[hostId]/edit.tsx
  • mobile/src/transport/client-context.test.ts
  • mobile/src/transport/direct-request-pipeline.ts
  • mobile/src/transport/direct-rpc-client.ts
  • mobile/src/transport/endpoint-auth-headers-store.test.ts
  • mobile/src/transport/endpoint-auth-headers-store.ts
  • mobile/src/transport/endpoint-auth-headers-store.web.ts
  • mobile/src/transport/endpoint-auth-headers.test.ts
  • mobile/src/transport/endpoint-auth-headers.ts
  • mobile/src/transport/host-entry-opener.ts
  • mobile/src/transport/host-logical-client.ts
  • mobile/src/transport/host-open-recovery.test.tsx
  • mobile/src/transport/mobile-endpoint-lifecycle.ts
  • mobile/src/transport/rpc-client-socket-factory.ts
  • mobile/src/transport/rpc-client-socket-headers.test.ts
  • mobile/src/transport/rpc-client-socket-session.ts
  • mobile/src/transport/rpc-client.ts
  • mobile/src/transport/settings-host-client-lifecycle.test.ts
  • mobile/src/transport/unpaired-host-credential-deletion.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread mobile/app/h/[hostId]/edit.tsx Resolved
Comment thread mobile/app/h/[hostId]/edit.tsx Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

One finding can silently clear saved edge credentials after a keychain read failure — details inline. Everything else looks sound; the WebSocket header plumbing checks out on both platforms.

Reviewed changes

  • New edge-auth header model — endpoint-auth-headers.ts validates/normalizes name/value rows, redacts values for logs, caches a per-host snapshot, and builds the header-carrying socket via Reflect.construct.
  • SecureStore persistence — endpoint-auth-headers-store.ts writes/reads/deletes a zod-validated bundle through the pairing keychain, marks the host credential write revision, and has a no-op .web.ts sibling.
  • Transport plumbing — edgeAuthHeaders threads through ConnectOptions → DirectRpcClient → RpcClientSocketFactory → RpcClientSocketSession; both direct dial sites read the snapshot and host-entry-opener.ts primes it before the client is built.
  • Edit-host UI — edge-auth-headers-section.tsx and edit.tsx read/write/delete headers and refresh the live client when they change.
  • Unpair cleanup — deletes the bundle alongside the other host credentials.
  • Unrelated extraction — direct-request-pipeline.ts plus the liveness-probe counter move; no functional change I can see.

ℹ️ Pairing still cannot present edge credentials

Edge headers are only configurable after pairing (Edit host), and the pairing dial (pre-profile-pairing-coordinator → connectDirect) does not carry them. A desktop that is reachable only through the authenticated tunnel still has to be paired over LAN/relay/VPN first. If that is intended (the issue scopes pairing out), a line in the Edit-host help text would set expectations; otherwise the pairing path needs the same snapshot.

ℹ️ Nitpicks

  • The new unpair deletion (unpaired-host-credential-deletion.ts:56) has no test — host-credential-cleanup.test.ts covers the scheduler, not this module — so the "cleared on unpair" security promise is unpinned.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Comment thread mobile/app/h/[hostId]/edit.tsx Resolved
- wss-only guard for edge-auth headers (editor + dial path)
- fail-closed auth baseline on edit screen, no phantom dirty state
- split header commit from metadata commit on save
- hide section on web, move section out of the route tree
- prime-then-recheck cancelled opens, snapshot write-through and
  synchronous clear on removal
- cap values at 1 KiB, truncate invalid names in errors
- cover removal chain, redial reuse, prime wiring, pipeline ids

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the two commits on top of 041d9b0803, focusing on the follow-up 396fc889d1.

  • Moved edge-auth UI out of the router tree — useEdgeAuthHeaders and EdgeAuthHeadersSection now live in src/components/edge-auth-headers-section.tsx instead of the Expo Router app/ tree.
  • Fail-closed non-wss dial — new edgeAuthHeadersForEndpoint yields headers only for wss://; the socket factory drops them with a names-only warning, and the edit screen independently blocks saving non-empty headers on a ws:// address.
  • Hardened store read/write paths — writeEndpointAuthHeaders now writes through to the in-memory snapshot, MAX_VALUE_LENGTH dropped from 4096 to 1024 with a documented keychain rationale, and a store-read failure blocks the edit form (load-error) instead of enabling Save against a mismatched baseline.
  • Re-check after priming — host-entry-opener re-checks isCurrent/isWanted/state.store after the awaited prime, so a canceled open no longer constructs a client.
  • Unpair cleanup coverage — deleteEndpointAuthHeaders in the deletion pipeline is now exercised by a test, and removeHost synchronously clears the in-memory snapshot so a re-paired host id cannot inherit stale headers.
  • Unrelated extraction — direct-request-pipeline.ts shares one nextId across requests, streams, and the liveness probe.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2c09c9dc-9aad-495c-a057-25c491c14b9f
📥 Commits

Reviewing files that changed from the base of the PR and between 041d9b0 and 396fc88.

📒 Files selected for processing (17)
  • mobile/app/h/[hostId]/edit.tsx
  • mobile/src/components/edge-auth-headers-section.tsx
  • mobile/src/diagnostics/use-mobile-web-bundle-probe.test.tsx
  • mobile/src/host-edit-route-accessibility.test.ts
  • mobile/src/transport/direct-request-pipeline.test.ts
  • mobile/src/transport/direct-request-pipeline.ts
  • mobile/src/transport/direct-rpc-client.ts
  • mobile/src/transport/endpoint-auth-headers-store.test.ts
  • mobile/src/transport/endpoint-auth-headers-store.ts
  • mobile/src/transport/endpoint-auth-headers.test.ts
  • mobile/src/transport/endpoint-auth-headers.ts
  • mobile/src/transport/host-entry-opener.ts
  • mobile/src/transport/host-open-recovery.test.tsx
  • mobile/src/transport/host-store.ts
  • mobile/src/transport/rpc-client-socket-factory.ts
  • mobile/src/transport/rpc-client-socket-headers.test.ts
  • mobile/src/transport/unpaired-host-credential-deletion.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • mobile/app/h/[hostId]/edit.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8e9ef02c-9827-4bec-89eb-5561aeae9804
📥 Commits

Reviewing files that changed from the base of the PR and between 396fc88 and 749609c.

📒 Files selected for processing (4)
  • mobile/src/transport/endpoint-auth-headers-store.test.ts
  • mobile/src/transport/endpoint-auth-headers-store.ts
  • mobile/src/transport/endpoint-auth-headers-store.web.ts
  • mobile/src/transport/host-entry-opener.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the one commit on top of 396fc889d1, focusing on the hardening in 749609ccf0.

  • Normalize on write — writeEndpointAuthHeaders now runs input through normalizeEndpointAuthHeaders before persisting, so a write can never store a bundle that the reader's parseStoredBundle would later reject. Invalid rows throw a name-only Invalid edge-auth headers: ... error (values never appear).
  • Guard prime against stale opens — primeEndpointAuthHeaders accepts an optional isCurrent predicate and skips caching the snapshot when the open is no longer current, so a removal that cleared the cache mid-read cannot be resurrected. host-entry-opener passes its isCurrent and still re-checks ownership after the await.
  • Test coverage — added cases pinning that un-normalizable headers are rejected without touching the keychain, and that a non-current prime returns headers without caching.
  • No regressions — write is only reached via useEdgeAuthHeaders.persistAuthChanges (already normalized), and the web sibling signature stays in sync.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one minor correctness note inline.

Reviewed changes

This run re-reviewed the single commit on top of 749609ccf0, the prime/hardening change in a925e75.

  • Prime skips cache on a mid-read write — primeEndpointAuthHeaders snapshots getHostCredentialWriteRevision(hostId) before the keychain read and only caches when the revision is unchanged afterward, so a header write landing during the read wins instead of being overwritten by the stale value.
  • Failed read no longer clobbers a concurrent write — the catch branch caches null only when the revision is still unchanged.
  • Test — a new case marks a write from inside the mocked getItemAsync and asserts the snapshot stays empty.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit on top of a925e75, the prime/removal hardening in a78a90c.

  • Auth mutation epoch — added noteEndpointAuthHeadersChanged / endpointAuthMutationEpoch to the shared module; writes, deletes, and removals bump a per-host epoch, and primeEndpointAuthHeaders now caches only when both the credential write revision and the epoch are unchanged across the read.
  • Delete bumps the epoch, not the revision — deleteEndpointAuthHeaders deliberately avoids markHostCredentialWrite (a revision change would trip the deferred cleanup re-pair guard in unpaired-host-credential-deletion), so the epoch is what invalidates an in-flight prime on a clear.
  • Removal clears the snapshot — moved the synchronous edge-auth cache clear out of host-store.removeHost into removeHostAndCloseClient, paired with the epoch bump; base host-store is unchanged again and removeHost has no other production caller.
  • Tests — a mid-read clear case in the store suite, plus removal coverage asserting the snapshot is cleared and the epoch advances.

The prior open thread (endpoint-auth-headers-store.ts:101, mid-read clear re-caching removed headers) is addressed by this epoch mechanism and has been resolved.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit on top of 02e0149, the dial-diagnostics change in ebda868.

  • Edge-auth names in dial diagnostics — RpcClientSocketFactory.open now appends the names-only describeEndpointAuthHeadersForLog(edgeAuthHeaders) output to the Opening WebSocket / Reconnecting log detail when headers actually ride the dial (i.e. the endpoint passed the wss:// gate), while headerless dials keep the previous redactSocketEndpoint string. Values still never enter the detail.
  • Test coverage — the handshake test now pins that the Opening WebSocket entry's detail contains the endpoint host and both header names, alongside the existing assertions that neither value appears in the logs.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit on top of ebda868, 6198469a ("scroll focused edge-auth row into view").

  • Scroll the focused edge-auth row above the keyboard — EdgeAuthHeadersSection subscribes to subscribeSoftKeyboard, tracks the focused row id and row refs, and on a keyboard-show event scrolls that row's native handle into view through the parent ScrollView's scrollResponderScrollNativeHandleToKeyboard. edit.tsx threads its form ScrollView ref down as scrollViewRef.
  • Extracted the wss:// endpoint gate — the edit screen's inline authNeedsWss computation is now checkEdgeAuthEndpoint(headers, endpoint) in endpoint-auth-headers.ts, alongside edgeAuthHeadersForEndpoint; canSave and the section error both derive from it. Behavior is unchanged (empty headers pass, non-empty headers require a wss:// endpoint).
  • Test coverage — new edge-auth-headers-section.test.tsx pins that a keyboard show scrolls the focused row (handle 123, numeric offset, preventNegativeScrollOffset true); host-edit-route-accessibility.test.ts adds the Keyboard mock the section now needs.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit on top of 6198469a, 8bf79833 ("default bare wss addresses to 443").

  • Bare wss:// defaults to :443 — resolveHostEndpointEdit now detects a wss://-schemed input with no explicit port and uses 443 as the fallback instead of the stored endpoint's port, so typing a tunnel hostname no longer aims TLS at the stored :6768.
  • Explicit ports and other inputs unchanged — an explicit :port still wins, and bare-host / ws:// inputs keep inheriting the current port; the edit.tsx help text was updated to match.
  • Test coverage — three exact-equality cases pin the new default plus explicit-port precedence (host-endpoint-edit.test.ts:44-52).

The prior open thread on this PR (mid-read clear re-caching removed headers) remains resolved by the a78a90c mutation-epoch mechanism; nothing in this delta reopens it.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit on top of 8bf79833, 87699b45 ("scroll header row into view on focus").

  • Scroll on focus, not only on keyboard-show — EdgeAuthHeadersSection extracts scrollFocusedRowIntoView and now calls it from focusRow, so focusing a row scrolls it into view immediately when the keyboard was already open from an earlier field (no new keyboard-show event fires in that case). The keyboard-show subscription still scrolls as before.
  • Test coverage — a new case in edge-auth-headers-section.test.tsx focuses an input with no keyboard event and asserts the scroll call, pinning the focus-only path.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@chunchet-ng

Copy link
Copy Markdown
Contributor

I adapted the mobile header work into #31880, preserving Mark Hingston's co-author credit. The follow-up adds secure-origin binding, authenticated-socket redirect refusal, native capability checks and cancellation/logging regressions.

The remaining client paths are split into #31886 (initial native pairing through Access) and #31885 (desktop protected storage and CLI credential-file input); #31499 covers sharing addresses/documentation. Linking these for coordination and review of the overlapping work, rather than assuming this PR should be closed.

These are open review proposals, not released support. Upstream PR CI still needs maintainer approval; real-device and browser Access-session acceptance remain outstanding. Tunnel creation remains manual.

@mhingston mhingston closed this by deleting the head repository Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Support authenticated BYO tunnel endpoints for Orca Mobile

3 participants