Skip to content

fix(ios): stop persisting pasted setup codes - #197049

Merged
obviyus merged 2 commits into
mainfrom
fix/ios-setup-code-memory-only
Nov 11, 2026
Merged

obviyus merged 2 commits into
mainfrom
fix/ios-setup-code-memory-only

Conversation

@obviyus

@obviyus obviyus commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

The setup code field in Settings → Gateway was backed by @AppStorage("gateway.setupCode"), so every pasted or typed character was saved to the app's preferences plist. A setup code carries Gateway credentials: a bootstrap token, token or password. When setup failed or was abandoned, the code stayed in plain text in the app container and in device backups. Onboarding already keeps the same input in memory (@State).

Change

  • Settings keeps setupCode in @State, matching onboarding.
  • OpenClawApp.init removes the old gateway.setupCode key at launch, next to the existing share.defaultInstruction cleanup, so existing installs don't keep an earlier code.
  • The onboarding reset no longer writes the key, since nothing reads it now.

Evidence

iPhone 17 simulator (iOS 27), reading gateway.setupCode from the app's preferences plist. I pasted a fake code and terminated the app without connecting.

Step Build gateway.setupCode
Paste, terminate main Present, holds the pasted code
Install this PR over that data, launch This PR Removed
Fresh install, paste, terminate This PR Never written
Paste a real setup code from a test Gateway → Connect This PR Connects and the field clears; key still absent

SwiftFormat and SwiftLint strict are clean.

Found by an audit of the iOS app.

@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. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed clawsweeper:intake:bug 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 keeps pasted iOS Gateway setup codes in memory, clears them on onboarding reset, and removes previously persisted codes at launch.

Example: Paste the synthetic value review-demo into Settings → Gateway, then terminate and relaunch the app.

  • Before: The pasted value remains in gateway.setupCode in the preferences plist.
  • After: The field starts empty, and gateway.setupCode is absent.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct patch supported by reported simulator and stable-upgrade results; the prior reset defect is fixed.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Author-reported iPhone 17 simulator results exercise the native Settings input, app termination and relaunch, legacy-key removal, fresh-install non-persistence, and connection to an isolated test Gateway; the stable-upgrade report preserves pairing and unrelated settings.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Abandoned or failed Gateway setup leaves credential-bearing pasted input in the app's preferences and subsequent backups.
Reason: The collaborator-authored direction removes unnecessary secret persistence while retaining the existing pairing flow and explicitly preserving unrelated upgrade state.

Merge readiness

✅ Ready for maintainer review

This PR fixes credential-bearing input persistence that remains on main, and the prior reset finding is resolved; no actionable patch defects remain.

Priority: P2
Reviewed head: f01c7ac40deca900221df0a3d47ea7fd0d65eda0

Before merge

None.

Findings

None.

Agent review details

How this fits together

Native iOS Gateway Settings accepts setup input and passes parsed credentials to the existing connection owner; app startup removes legacy input storage and onboarding resets clear transient input.

flowchart TD
  A[Pasted setup code] --> B[Settings memory state]
  B --> C[Existing setup parser]
  C --> D[Gateway connection owner]
  E[Onboarding reset] --> B
  F[App startup] --> G[Remove legacy preference]
Loading

Technical review

Best possible solution:

Keep setup input transient, remove its legacy preference at startup, and preserve existing connection and reset owners as this patch does.

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

The current-main TextField writes directly through AppStorage, establishing persistence from source; the author also reports reproducing the stored value in a simulator plist.

Is this the best way to solve the issue?

This is the smallest complete fix: use the existing transient input owner, remove the legacy value, and preserve reset clearing without adding another storage or credential path.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Settings setup-code persistence changes intended behavior with a stated reason (f6e51ff: The Pro UI refresh carried setup input as an AppStorage-backed setting; its stated purpose was refreshed native surfaces and Gateway flows, without a requirement to persist unsubmitted credentials.)
  • Onboarding reset clearing keeps the original intent (4f933cc: Gateway recovery moved to the root toast while Settings retained a reset synchronization callback; clearing the new State value preserves the former reset outcome.)
  • Launch-time legacy preference cleanup keeps the original intent (ef26537: The native Settings consolidation already performs targeted cleanup of retired preferences at app launch; the new cleanup uses that lifecycle without changing Gateway ownership.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 862de9f adds apps/ios/Sources/Design/SettingsProTabActions.swift:194 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 862de9f1a1c2; files: apps/ios/Sources/Design/SettingsProTabActions.swift)

PR surface

Source +3. Total +3 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 5 2 +3
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 5 2 +3

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 status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This focused fix prevents abandoned credential-bearing setup input from remaining in iOS preferences without changing normal pairing behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 (2 earlier review cycles)
  • reviewed 2026-11-11T05:49:44.125Z sha da9a83f :: blocked before merge. :: none
  • reviewed 2026-11-11T06:17:09.623Z sha da9a83f :: needs changes before merge. :: [P3] Clear the in-memory setup code after root-owned onboarding resets

Reviewed November 11, 2026, 1:49 AM ET / 06:49 UTC (Revision 3).

@obviyus

obviyus commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator Author

Upgrade proof: latest stable v2026.11.3 → this PR. iOS 27 simulator, isolated test Gateway.

Check Stable v2026.11.3 After installing this PR over the same app data (no erase; launch, wait, relaunch)
Gateway Connected, paired Connected; same paired gateway, no re-pairing
Node on the Gateway 565af9e5… approved Same node and approval; no pending request
Chat Message sent, Gateway reply received Same
Settings setup-code field Fake code pasted, not connected Empty
gateway.setupCode in the preferences plist The pasted fake code Removed
Plist keys 16 15: only gateway.setupCode removed. Other values are unchanged apart from a timestamp and the watch bridge state

I compared the plist by key name, type and a hash of each value, never the values themselves. The test Gateway returns the same model-config error to chat on both builds, so it has nothing to do with this change.

@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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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

Addressed the review item in f01c7ac40de: syncAfterOnboardingReset() now clears the in-memory setupCode. That callback runs on every onboardingRequestID change, which is the reset path where the old @AppStorage binding used to empty the field. A root-owned onboarding reset therefore can't bring back a pasted code when Settings is shown again. The app builds cleanly.

@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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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 66e7e2d into main Nov 11, 2026
77 checks passed
@obviyus
obviyus deleted the fix/ios-setup-code-memory-only branch November 11, 2026 06:59
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 12, 2026
* fix(ios): stop persisting pasted setup codes

* fix(ios): clear a pasted setup code when onboarding resets
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]>
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 16, 2026
Adapt to the 2026.11.4 release owners and fixtures; preserve current safety and timeout contracts. Source inspected by release owner. Independent local review explicitly waived by Dallin; CI qualification remains pending.

(cherry picked from commit 66e7e2d)

Co-authored-by: RomneyDa <[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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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