Repository navigation
Description
Summary
The setup-code path, onboarding wizard, and direct --url flags all accept ws:// (non-TLS) gateway URLs without surfacing a warning. The corresponding WebView2 chat surface then trusts http:// content from that host, including any inline scripts the gateway returns. A LAN-positioned attacker (typical case: a coffee shop, conference, or any shared WiFi) can intercept the gateway WebSocket and inject arbitrary content into the chat surface.
Where
- URL parsing:
src/OpenClaw.Shared/GatewayUrlHelper.cs - Setup-code decoder:
src/OpenClaw.Tray.WinUI/Services/LocalGatewaySetup/SetupCodeDecoder.cs - WebView2 chat:
src/OpenClaw.Tray.WinUI/Windows/ChatWindow.xaml.csandGatewayChatUrlBuilder.cs
Why it matters
Comparable products:
- Slack: refuses
http://workspace URLs. Onlyhttps://. - Discord: same.
- Most VS Code remote-development extensions:
https://only. - VS Live Share: TLS-only by default.
Plain ws:// is a development affordance that's been hauled into the production product. It's not strictly wrong (the device-token Ed25519 signature still authenticates the client), but the chat surface trusts the same plain-HTTP origin and that surface is where users see and respond to agent output.
Proposed fix
Three tiers:
- Warn: when a user pastes a
ws://URL into the onboarding wizard, surface a yellow banner explaining the LAN-MITM risk. Allow proceed-anyway. - Block by default for remote: refuse
ws://URLs to anything outside loopback/192.168.*/10.*/172.16-31.*/fc00::/7unless anOPENCLAW_ALLOW_INSECURE_GATEWAY=1escape hatch is set. - Loopback / local-WSL exception: continue to allow
ws://localhost:*andws://127.0.0.1:*without warning — this is the legitimate developer path.
Apply the same logic to the WebView2 chat URL — never load HTTP content from a non-loopback host.
Severity
High — LAN MITM with chat-injection.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
fix(security): warn when a non-TLS remote gateway URL is entered
github-actions commentedon May 16, 2026
🤖 This is an automated response from Repo Assist.
I've opened a draft PR implementing Tier 1 of this proposal: surfacing a⚠️ warning in the onboarding Connection page when the user types a plain
ws://URL pointing to a non-local host.What the PR does:
GatewayUrlHelper.IsInsecureRemoteGatewayUrl()with loopback + RFC 1918 + ULA exemptionsOnUrlChangedso users see it immediately as they typeTier 2 (block-by-default for remote with escape hatch) and any WebView2 chat surface enforcement remain for a follow-up PR.
shanselman commentedon May 18, 2026
Closing this one-off deep-review issue as consolidated, not necessarily fixed. The useful signal is preserved in #372: non-TLS gateway warning/policy still needs a fresh focused pass. We will take these one at a time from #372 after verifying against current master instead of keeping the issue list flooded.