Skip to content

Fix private LAN mobile pairing auth policy#78140

Closed
BunsDev wants to merge 5 commits intomainfrom
meow/fix-ios-lan-pairing-auth
Closed

Fix private LAN mobile pairing auth policy#78140
BunsDev wants to merge 5 commits intomainfrom
meow/fix-ios-lan-pairing-auth

Conversation

@BunsDev
Copy link
Copy Markdown
Member

@BunsDev BunsDev commented May 6, 2026

Summary

Fixes the private-LAN mobile pairing policy for #47887 without opening public or tailnet plaintext routes.

  • allows ws:// setup/manual endpoints only for loopback, private LAN, link-local, ULA, and .local hosts across iOS setup/manual paths, Android setup/manual paths, the setup-code generator, and the device-pair plugin
  • keeps public and Tailscale/tailnet cleartext endpoints rejected; those still require wss:// or a tunnel/Serve/Funnel path
  • makes explicit password auth suppress stale bootstrap-token auth in Swift and TypeScript gateway clients
  • persists Android bootstrap handoff tokens for the same private/local cleartext endpoints that Android setup/manual pairing accepts, while keeping public/tailnet cleartext persistence rejected
  • adds mixed-auth, private-LAN, .local, public, tailnet, and Android session persistence coverage for the changed clients and setup-code paths
  • includes a small iOS onboarding compile fix so the setup-code parser symbol is imported where the onboarding flow uses it

Verification

  • pnpm test src/gateway/client.test.ts extensions/device-pair/index.test.ts src/pairing/setup-code.test.ts src/cli/qr-cli.test.ts passed locally
  • swift test --package-path apps/shared/OpenClawKit --filter 'DeepLinksSecurityTests|GatewayNodeSessionTests' passed locally at 77b48f43b1 with 26 tests
  • Android targeted Testbox proof passed at fbd0c6afdb: cd apps/android && ./gradlew :app:testPlayDebugUnitTest --tests ai.openclaw.app.gateway.GatewaySessionInvokeTest.bootstrapHandoffPersistenceTrustsPrivateLanCleartextEndpoints --tests ai.openclaw.app.ui.GatewayConfigResolverTest --tests ai.openclaw.app.node.ConnectionManagerTest
  • pnpm check:changed passed in Testbox at fbd0c6afdb
  • live proof is still pending: no Android adb/emulator is available locally, connected iOS devices are unavailable, and the iOS simulator app target still fails before launch on unrelated apps/ios/Sources/Settings/SettingsTab.swift issues (SwiftFormat drift on the branch state; after a local formatting experiment, Swift type-check timeout at line 423). The formatting experiment was reverted and is not part of this PR.

Fixes #47887.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: ios App: ios gateway Gateway runtime cli CLI command changes extensions: device-pair size: M maintainer Maintainer-authored PR labels May 6, 2026
@BunsDev BunsDev self-assigned this May 6, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 6, 2026

Codex review: needs maintainer review before merge.

Summary
The PR broadens private/local mobile ws:// setup and manual pairing, aligns bootstrap handoff persistence, preserves public/tailnet plaintext rejection, and updates related tests and docs.

Reproducibility: yes. by source inspection. Current Android main still rejects private-LAN cleartext manual/scanned endpoints and persists bootstrap handoff tokens only on loopback or TLS; I did not establish a live-device repro.

Real behavior proof
Not applicable: Not applicable because this is a member PR with the protected maintainer label, though the PR body still notes final live iOS/Android pairing proof is unavailable.

Next step before merge
Protected maintainer draft needs rebase/conflict handling, security-policy sign-off, and live mobile proof rather than an autonomous repair job.

Security
Cleared: No dependency, workflow, package, or secret-handling regression was found; the plaintext policy change is security-sensitive but bounded to private/local mobile pairing.

Review details

Best possible solution:

Rebase onto current main, preserve the mainline Swift/TypeScript behavior, land the remaining Android/docs/protocol alignment, and merge only after maintainer sign-off plus live mobile pairing proof.

Do we have a high-confidence way to reproduce the issue?

Yes, by source inspection. Current Android main still rejects private-LAN cleartext manual/scanned endpoints and persists bootstrap handoff tokens only on loopback or TLS; I did not establish a live-device repro.

Is this the best way to solve the issue?

Mostly yes, but not merge-ready. The narrow code direction matches the remaining Android/docs gap while preserving public and tailnet plaintext rejection, but the stale draft branch needs rebase, conflict review, and live pairing proof.

Acceptance criteria:

  • pnpm test src/gateway/client.test.ts extensions/device-pair/index.test.ts src/pairing/setup-code.test.ts src/cli/qr-cli.test.ts
  • cd apps/android && ./gradlew :app:testPlayDebugUnitTest --tests ai.openclaw.app.gateway.GatewaySessionInvokeTest --tests ai.openclaw.app.ui.GatewayConfigResolverTest --tests ai.openclaw.app.node.ConnectionManagerTest
  • swift test --package-path apps/shared/OpenClawKit --filter 'DeepLinksSecurityTests|GatewayNodeSessionTests'
  • pnpm check:changed in Testbox after rebase/conflict resolution
  • Live iOS and Android private-LAN setup-code/manual pairing proof

What I checked:

Likely related people:

  • Val Alexander: Authored 36df0d93b93a (fix: repair iOS LAN pairing) and blame shows this commit on the central Swift and TypeScript private/local pairing helpers. (role: recent mainline policy maintainer; confidence: high; commits: 36df0d93b93a; files: apps/shared/OpenClawKit/Sources/OpenClawKit/LoopbackHost.swift, apps/ios/Sources/Gateway/GatewayConnectionController.swift, src/pairing/setup-code.ts)
  • Peter Steinberger: Blame on the current Android gateway, session, node connection, and config resolver paths points to 24853ced114a; adjacent native node work also appears in 466f7183207d. (role: adjacent Android/gateway owner; confidence: medium; commits: 24853ced114a, 466f7183207d; files: apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayHostSecurity.kt, apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewaySession.kt, apps/android/app/src/main/java/ai/openclaw/app/node/ConnectionManager.kt)

Remaining risk / open question:

  • The PR body says live iOS/Android pairing proof is still pending, so device-runtime behavior is not proven end to end.
  • The branch is a draft and reported mergeable false; rebasing over current main could change the Swift/TypeScript policy overlap.
  • The plaintext exception is security-sensitive even though the diff keeps public and tailnet cleartext blocked.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 60171e863882.

Re-review progress:

@BunsDev BunsDev marked this pull request as ready for review May 6, 2026 00:29
@BunsDev BunsDev requested a review from a team as a code owner May 6, 2026 00:29
@BunsDev
Copy link
Copy Markdown
Member Author

BunsDev commented May 7, 2026

Closing this draft as superseded by #78807, which recreates the relevant mobile private LAN pairing/auth fixes from a fresh current main branch with a single verified signed commit and fresh verification notes.

@BunsDev BunsDev closed this May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: ios App: ios channel: whatsapp-web Channel integration: whatsapp-web cli CLI command changes docs Improvements or additions to documentation extensions: device-pair extensions: diagnostics-otel Extension: diagnostics-otel gateway Gateway runtime maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: iOS LAN gateway connects are forced to wss, and bootstrap-only setup codes fail onboarding

1 participant