Skip to content

[deep-review] C9: Plain ws:// gateway URLs are accepted with no TLS warning #349

Closed

Description

@codemonkeychris

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.cs and GatewayChatUrlBuilder.cs

Why it matters

Comparable products:

  • Slack: refuses http:// workspace URLs. Only https://.
  • 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:

  1. Warn: when a user pastes a ws:// URL into the onboarding wizard, surface a yellow banner explaining the LAN-MITM risk. Allow proceed-anyway.
  2. Block by default for remote: refuse ws:// URLs to anything outside loopback/192.168.*/10.*/172.16-31.*/fc00::/7 unless an OPENCLAW_ALLOW_INSECURE_GATEWAY=1 escape hatch is set.
  3. Loopback / local-WSL exception: continue to allow ws://localhost:* and ws://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.

Activity

  1. linked a pull request that will close this issueHarden plain WebSocket gateway URL handling #394on May 14, 2026
  2. github-actions commented on May 16, 2026

    @github-actions
    Contributor

    🤖 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:

    • Adds GatewayUrlHelper.IsInsecureRemoteGatewayUrl() with loopback + RFC 1918 + ULA exemptions
    • Shows the warning inline in OnUrlChanged so users see it immediately as they type
    • Warning is non-blocking — users can still connect
    • 17 new test cases covering remote, loopback, private-range, and edge cases

    Tier 2 (block-by-default for remote with escape hatch) and any WebView2 chat surface enforcement remain for a follow-up PR.

    Generated by 🌈 Repo Assist, see workflow run. Learn more.

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/repo-assist.md@97143ac59cb3a13ef2a77581f929f06719c7402a
    
  3. shanselman commented on May 18, 2026

    @shanselman
    Collaborator

    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.

  4. locked as resolved and limited conversation to collaborators on May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions