Skip to content

feat: add support for self-signed TLS certificates#99

Open
yeager wants to merge 2 commits intogrp06:mainfrom
yeager:allow-self-signed-certs
Open

feat: add support for self-signed TLS certificates#99
yeager wants to merge 2 commits intogrp06:mainfrom
yeager:allow-self-signed-certs

Conversation

@yeager
Copy link
Copy Markdown

@yeager yeager commented Mar 21, 2026

Problem

OpenClaw Studio cannot connect to gateways using self-signed TLS certificates (common with Tailscale Serve, local networks, development setups). WebSocket connections fail with certificate validation errors.

Solution

Adds a UI toggle "Allow self-signed certificates" in the gateway connection settings:

  • Toggle in connection UI (GatewayConnectScreen + ConnectionPanel)
  • Warning displayed when enabled: "⚠️ Self-signed certificates are enabled. Do not use in production."
  • Passes rejectUnauthorized: false to WebSocket when enabled
  • Persisted in gateway settings
  • Defaults to false (secure by default)

Changes

  • gateway-connect-profile.ts — Extended GatewaySocketOptions with rejectUnauthorized
  • contracts.ts — Updated settings contract
  • openclaw-adapter.ts — Pass setting to WebSocket
  • settings.ts — Settings normalization + merge
  • useStudioGatewaySettings.ts — State management
  • GatewayConnectScreen.tsx + ConnectionPanel.tsx — UI toggle + warning
  • Tests updated

Use cases

  • Tailscale Serve with custom certificates
  • Local development environments
  • Private network deployments
  • Air-gapped installations

Build passes (npm run build ✅)

Daniel Nylander added 2 commits March 21, 2026 16:16
Add toggle in UI to allow self-signed TLS certificates for gateway connections.
This is useful for Tailscale Serve with custom certs, local development,
and private networks with self-signed certificates.

Changes:
- Added rejectUnauthorized option to GatewaySocketOptions
- Extended StudioGatewaySettings with allowSelfSignedCerts field
- Updated buildGatewayConnectProfile to pass rejectUnauthorized setting
- Modified OpenClawAdapter to handle rejectUnauthorized in WebSocket options
- Added UI checkbox in GatewayConnectScreen and ConnectionPanel
- Updated useStudioGatewaySettings to manage the new setting
- Added warning message when self-signed certs are enabled
- Updated unit tests to include new props

Fixes connection issues with self-signed certificates.
- Fix unit tests to include allowSelfSignedCerts field in assertions
- Use semantic ui-alert-danger class for warning messages
- Update test expectations in studioSettings and studioSettingsRoute tests
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 45ba4819d9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 404 to 408
gateway: {
url: trimmedGatewayUrl,
token: token.trim(),
allowSelfSignedCerts: allowSelfSignedCerts,
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Honor the self-signed toggle in the test-connection API

useStudioGatewaySettings now posts gateway.allowSelfSignedCerts here, but src/app/api/studio/test-connection/route.ts:11-49 still only reads gateway.url/gateway.token and constructs loadSettings: () => ({ url, token }). In the exact scenario this feature is meant to unblock—a wss:// gateway with a self-signed certificate—the Test connection button will still fail with the old TLS validation error even after the box is checked.

Useful? React with 👍 / 👎.

Comment on lines 335 to +338
token: settings.token,
protocol: CONNECT_PROTOCOL,
capabilities: CONNECT_CAPABILITIES,
rejectUnauthorized: settings.allowSelfSignedCerts ? false : undefined,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reconnect live adapters when TLS validation changes

This new flag is only consumed when connect() builds the websocket profile, but src/app/api/studio/route.ts:32-47 still defines a gateway-settings change as url/token only before deciding whether to call reconnectForGatewaySettingsChange(). If the runtime is already connected, toggling the checkbox and saving persists the setting but leaves the existing websocket running with its previous TLS policy until some later restart, so the live connection never picks up the new option.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant