Skip to content

fix(ios): drop the unexposed unattended deep-link key - #197172

Merged
obviyus merged 3 commits into
mainfrom
fix/ios-drop-deeplink-key
Nov 11, 2026
Merged

obviyus merged 3 commits into
mainfrom
fix/ios-drop-deeplink-key

Conversation

@obviyus

@obviyus obviyus commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The iOS app kept a random "unattended deep-link key" in UserDefaults (deeplink.agent.key). An openclaw://agent link carrying it skipped the confirmation prompt and could send up to 20,000 characters. Unlike macOS (Debug Settings shows the key), iOS never shows the key anywhere, so no user or shortcut can hold it. The result was a secret stored outside the Keychain that only someone reading the app's preferences could use.

Solution

  • Delete the key and the key-only branch on iOS. Every agent deep link now goes through local confirmation (with delivery/routing fields stripped), which is the path all real links already took.
  • Scrub the stored key at startup, next to the existing gateway.setupCode scrub.
  • Add a short Secrets rule to apps/ios/AGENTS.md: secrets go through the Keychain store, never UserDefaults/@AppStorage/plain files.

The shared AgentDeepLink.key field stays because macOS uses it.

Impact

No visible change: no one could have the iOS key. Links over 240 characters keep being rejected, as they already were for every real link.

Evidence

Upgrade from the latest stable, real Gateway (iOS 27 simulator, isolated ios-sim Gateway)

  1. Installed v2026.11.3 (6350a4b2df5, Debug), paired by setup code: Gateway: Connected.
  2. Stable, link with a wrong key: confirmation prompt shown; Cancel; the message never reached the Gateway (0 hits in session history). This made stable generate and store its key (deeplink.agent.key, 43 chars).
  3. Stable, link with that stored key plus deliver=1&to=123456&channel=telegram: no prompt. The message reached the Gateway (2 hits in the node session's history), and the Gateway logged agent delivery disabled … missing session delivery route (channel=- to=123456), so the delivery fields were sent too.
  4. Installed this branch over it, no reset. On first launch the app was still Gateway: Connected (pairing and settings kept), and the stored key was removed (Print: Entry, ":deeplink.agent.key", Does Not Exist).
  5. Same keyed link, same retired key: confirmation prompt shown (screenshot below, key redacted). Cancel → 0 hits in history, and no new to=123456 delivery line in the Gateway log.
  6. New keyed link → Run → exactly 1 hit in history, and still no new to=123456 delivery line, so the approved request carried no delivery fields.

Regression test

handle deep link with retired stored key still requires confirmation: stores the old key, opens a keyed link with delivery fields, and checks: prompt shown, no request sent; Cancel sends nothing; a later approval sends exactly one request with deliver == false, to == nil, channel == nil.

  • Head: ✔ … passed, ✔ Test run with 262 tests in 1 suite passed.
  • Base (parent's apps/ios/Sources): ✘ … failed after 5.153 seconds with 7 issues: no prompt (pendingAgentDeepLinkPrompt != nil failed), a request was sent before confirmation (sent.isEmpty ×2), and the sent request kept deliver, to and channel.

Other checks

  • NodeAppModelInvokeTests: 262 passed on head.
  • swiftformat --lint clean on changed Swift files; git diff --check clean.
  • No iOS reader of the key remains (no UI, share sheet, docs or test); macOS keeps its own key, shown in Debug Settings.

Keyed link with the retired key now asks for confirmation (key redacted)

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 11, 2026
@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR removes iOS unattended agent-link authentication, requires local confirmation, and deletes the retired key at startup.

Example: Open openclaw://agent?message=keyed&deliver=1&to=123456&channel=telegram&key=retired-demo-key with that key stored on iOS.

  • Before: The matching key bypasses confirmation and forwards the delivery fields.
  • After: Cancel sends nothing; Run sends one request with deliver=false and no recipient or channel.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused deletion with shipped-entry-point and stable-upgrade evidence, a meaningful regression, and the previous finding resolved.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The inspected simulator screenshot shows confirmation for a retired-key URL; the PR's real-Gateway upgrade trace records no effect after Cancel and one sanitized request after Run, covering rejection of the formerly trusted key before I/O. Only test setup changed after this proof.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: iOS retains a secret outside secure credential storage that can authorize agent execution without local confirmation.
Reason: The collaborator-authored direction removes an unexposed bypass, preserves the supported confirmation flow, and has matching upgrade evidence.

Merge readiness

✅ Ready for maintainer review

This PR is useful and correct: current main retains the hidden iOS key bypass, and the previous test-sleep finding is resolved. No actionable findings remain; CI is still running.

Priority: P2
Reviewed head: 0d0029235fae8a57b4e4e9936870a352f90deb0e

Before merge

None.

Findings

None.

Agent review details

How this fits together

The iOS URL handler parses agent links into NodeAppModel, which owns confirmation and forwards approved requests through the paired Gateway node connection.

flowchart LR
  A[Agent URL] --> B[Shared deep link parser]
  B --> C[iOS NodeAppModel]
  C --> D[Local confirmation]
  D --> E[Sanitized agent request]
  E --> F[Paired Gateway]
Loading

Technical review

Best possible solution:

Retain the existing iOS confirmation owner, remove its hidden key exception, and scrub only the retired preference.

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

Current-main source establishes that a matching stored key bypasses confirmation; the contributor also reports reproducing this through the stable iOS app and a real Gateway.

Is this the best way to solve the issue?

The patch is the smallest complete fix: it deletes the unused authentication branch, reuses existing confirmation and sanitization, and removes the persisted secret without changing shared or macOS contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a9c961f77748.

Provenance checked

  • iOS unattended-key exception changes intended behavior with a stated reason (ff4e6ca: The original hardening added local confirmation while retaining keyed unattended execution; this PR explains that the persisted iOS key has no user-facing exposure or supported consumer.)
  • Confirmation throttling and queuing keeps the original intent (iOS Security Stack 3/5: Runtime Security Guards #33031: The security stack tightened prompt rate limiting and retained incoming requests through coalescing and queuing.)
  • Startup removal of obsolete sensitive preferences keeps the original intent (fix(ios): stop persisting pasted setup codes #197049: The existing startup owner removes previously persisted setup credentials; this PR uses the same boundary for the retired key.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced changes: The pinned diff removes key generation, preference reads, and unattended submission while retaining the existing confirmation owner and adding startup cleanup. (apps/ios/Sources/Model/NodeAppModel.swift:9333, 0d0029235fae)
  • Current main still has the bypass: Current main compares incoming keys with a generated UserDefaults secret and permits unattended submission when they match. (apps/ios/Sources/Model/NodeAppModel.swift:9501, a9c961f77748)
  • Previous finding resolved: The latest commit replaces the 5.1-second sleep with a fresh approval model and retains rejection, cancellation, single-send, and sanitized-request assertions. (apps/ios/Tests/NodeAppModelInvokeTests.swift:9496, 0d0029235fae)
  • Upgrade and final-effect evidence: The PR body reports an isolated iOS simulator and real Gateway upgrade: the old key disappears, pairing remains connected, Cancel produces no history entry, and Run produces one entry without delivery routing. The downloaded screenshot directly shows the keyed-link confirmation. Production code is unchanged since that proof. (apps/ios/Sources/OpenClawApp.swift:600, 80e2f540d19f)
  • Stable release identity verified: The abbreviated object cited in the upgrade evidence is the annotated v2026.11.3 tag, which peels to the supplied latest-release commit. (847611dcaa3b)
  • Feature provenance and retained platform contract: The February confirmation change introduced the stored-key exception; iOS Security Stack 3/5: Runtime Security Guards #33031 subsequently added prompt coalescing and queuing, which this PR preserves. macOS still exposes its key and retains the shared key field. A follow-history traversal reached an unavailable old blob; the relevant introduction was independently verified from its commit diff. (apps/ios/Sources/Model/NodeAppModel.swift, ff4e6ca0d942)

Likely related people:

  • Ayaan Zaidi: Raw commit 66e7e2d adds apps/ios/Sources/OpenClawApp.swift:598 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 66e7e2d12318; files: apps/ios/Sources/OpenClawApp.swift)

PR surface

Source -33, Tests +16, Docs +4. Total -13 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 30 63 -33
Tests 1 29 13 +16
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 63 76 -13

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a focused security cleanup of an unexposed iOS authentication path, with no demonstrated urgent user outage.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-11-11T10:37:35.843Z sha 55b450a :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-11T12:24:59.300Z sha 80e2f54 :: needs changes before merge. :: [P3] Remove the real-time wait from the keyed-link regression
  • reviewed 2026-11-11T12:30:04.080Z sha 80e2f54 :: needs changes before merge. :: [P3] Remove the real-time wait from the keyed-link regression

Reviewed November 11, 2026, 10:42 AM ET / 15:42 UTC (Revision 4).

@obviyus

obviyus commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator Author

Upgrade proof: v2026.11.3 → this branch on a real isolated Gateway; keyed link with the retired key now waits for confirmation. Details in the PR body.

After upgrade from v2026.11.3: keyed link with the retired key asks for confirmation (key redacted)

@obviyus

obviyus commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 11, 2026
@obviyus

obviyus commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 11, 2026
@obviyus
obviyus merged commit 609ef82 into main Nov 11, 2026
79 checks passed
@obviyus
obviyus deleted the fix/ios-drop-deeplink-key branch November 11, 2026 16:15
@obviyus

obviyus commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 12, 2026
* fix(ios): drop the unexposed unattended deep-link key

* test(ios): keyed deep links with the retired key still need confirmation

* test(ios): avoid the prompt-throttle wait in the retired-key regression
RomneyDa added a commit that referenced this pull request Nov 12, 2026
Keep credential-bearing pasted codes in view memory and delete legacy
preferences at startup. Clear mounted Settings on onboarding reset.

Release adaptation: add two guards in the existing native source suite.
Native Swift checks remain unrun on this Linux host; qualification required.
Independent review omitted per release owner, not passed.
Companion #197172 retires a different deep-link key; not a dependency.

(cherry picked from commit 66e7e2d)

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant