macOS: add remote gateway token UI without clobbering config#40187
macOS: add remote gateway token UI without clobbering config#40187
Conversation
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟡 Remote gateway token persisted in plaintext JSON config with no permission hardening
DescriptionThe new remote gateway token feature writes the user-provided
Vulnerable sink code: try FileManager().createDirectory(
at: url.deletingLastPathComponent(),
withIntermediateDirectories: true)
try data.write(to: url, options: [.atomic])RecommendationAvoid persisting authentication tokens in plaintext config files. Preferred fix: store the remote gateway token in Keychain and keep only a reference (or no token at all) in If a config-file token must exist for compatibility, harden on-disk permissions:
Example (after try FileManager().setAttributes([
.posixPermissions: 0o700,
], ofItemAtPath: url.deletingLastPathComponent().path)
try FileManager().setAttributes([
.posixPermissions: 0o600,
], ofItemAtPath: url.path)Also consider:
Analyzed PR: #40187 at commit Last updated on: 2026-03-08T19:48:56Z |
16c6dfe to
279d59c
Compare
Greptile SummaryThis PR adds a Core implementation:
Test coverage: Known issues: Confidence Score: 4/5
Last reviewed commit: 279d59c |
| @@ -11,6 +11,7 @@ Docs: https://docs.openclaw.ai | |||
| - Talk mode: add top-level `talk.silenceTimeoutMs` config so Talk waits a configurable amount of silence before auto-sending the current transcript, while keeping each platform's existing default pause window when unset. (#39607) Thanks @danodoesdesign. Fixes #17147. | |||
| - CLI/install: include the short git commit hash in `openclaw --version` output when metadata is available, and keep installer version checks compatible with the decorated format. (#39712) thanks @sourman. | |||
| - Docs/Web search: restore $5/month free-credit details, replace defunct "Data for Search"/"Data for AI" plan names with current "Search" plan, and note legacy subscription validity in Brave setup docs. Follows up on #26860. (#40111) Thanks @remusao. | |||
There was a problem hiding this comment.
The changelog entry cites #34614 (the PR this work supersedes), but should reference the current PR #40187 for correct issue tracking.
| - Docs/Web search: restore $5/month free-credit details, replace defunct "Data for Search"/"Data for AI" plan names with current "Search" plan, and note legacy subscription validity in Brave setup docs. Follows up on #26860. (#40111) Thanks @remusao. | |
| - macOS/onboarding: add a remote gateway token field for remote mode, preserve existing non-plaintext `gateway.remote.token` config values until explicitly replaced, and warn when the loaded token shape cannot be used directly from the macOS app. (#40187) |
Prompt To Fix With AI
This is a comment left during a code review.
Path: CHANGELOG.md
Line: 13
Comment:
The changelog entry cites `#34614` (the PR this work supersedes), but should reference the current PR `#40187` for correct issue tracking.
```suggestion
- macOS/onboarding: add a remote gateway token field for remote mode, preserve existing non-plaintext `gateway.remote.token` config values until explicitly replaced, and warn when the loaded token shape cannot be used directly from the macOS app. (#40187)
```
How can I resolve this? If you propose a fix, please make it concise.279d59c to
e645e87
Compare
|
Landed via temp rebase onto
Thanks @cgdusek! |
|
Nice! I was trying to implement something like this too...but I feared I would have weakened security the way I was going about it; buffer overflow via random strings in the input box. So, I pulled my PR. 😅 |
Summary
gateway.remote.token.gateway.remote.tokenvalues unless the user explicitly edits the field, instead of silently clobbering them during app-state sync.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Gateway tokenfield.Gateway tokenfield.gateway.remote.tokenconfig values are preserved until explicitly replaced.gateway.remote.tokenvalue is not plaintext and cannot be used directly by the macOS app.Security Impact (required)
No)Yes)No)No)No)Yes, explain risk + mitigation:gateway.remote.tokenafter explicit user edit, and unsupported existing token shapes are preserved when untouched.Repro + Verification
Environment
apps/macos)gateway.mode=remote,gateway.remote.*Steps
gateway.remote.token.Expected
Actual
Evidence
Human Verification (required)
swift test --package-path apps/macos --filter AppStateRemoteConfigTestsswift test --package-path apps/macos --filter GatewayEndpointStoreTestsswift test --package-path apps/macos --filter SettingsViewSmokeTestsswift test --package-path apps/macos --filter OnboardingViewSmokeTestsgateway.remote.token.gateway.remote.tokenis preserved unless the user explicitly edits the field.swift test --package-path apps/macosrun is not currently stable on this host due unrelated baseline failures/flakes (ExecAllowlistTestsfixture mismatch;LowCoverageViewSmokeTestsexclusivity crash).Review Conversations
Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
gateway.remote.tokenfrom config and/or revert this PR.apps/macos/Sources/OpenClaw/AppState.swiftapps/macos/Sources/OpenClaw/GatewayRemoteConfig.swiftapps/macos/Sources/OpenClaw/GeneralSettings.swiftapps/macos/Sources/OpenClaw/OnboardingView+Pages.swiftgateway.remote.tokenvalues disappear after unrelated remote config edits.Risks and Mitigations
SecureFieldand keeps scope limited to remote gateway token entry.