Skip to content

fix(web): allow WebSocket connections from remote clients when --insecure is used#17440

Closed
shaase-ctrl wants to merge 1 commit into
NousResearch:mainfrom
shaase-ctrl:fix/websocket-insecure-tailscale
Closed

fix(web): allow WebSocket connections from remote clients when --insecure is used#17440
shaase-ctrl wants to merge 1 commit into
NousResearch:mainfrom
shaase-ctrl:fix/websocket-insecure-tailscale

Conversation

@shaase-ctrl

Copy link
Copy Markdown

Problem

When using hermes dashboard --insecure --host 0.0.0.0, the HTTP page loads fine over Tailscale/remote connections, but the WebSocket endpoints (/api/pty, /api/ws, /api/pub, /api/events) still rejected non-loopback clients with code 4403 (Forbidden).

This caused "Session ended" errors in the Chat tab when accessing the dashboard remotely via Tailscale, even though --insecure was passed.

Root Cause

In hermes_cli/web_server.py:

  • Line 3131: allow_public: bool = False is set when --insecure is used
  • Lines 2391, 2499, 2532, 2562: WebSocket handlers check _LOOPBACK_HOSTS unconditionally
  • allow_public was NOT stored in app.state for WebSocket handlers to check

Fix

  1. Store allow_public in app.state in start_server() (line 3158)
  2. Check app.state.allow_public before rejecting non-loopback clients in all 4 WebSocket handlers

Changes

  • Added app.state.allow_public = allow_public in start_server()
  • Updated WebSocket loopback check in pty_ws(), gateway_ws(), pub_ws(), events_ws() to skip the check when allow_public is True

Security Note

This fix only affects connections when --insecure is explicitly used. The default behavior (loopback-only) remains unchanged for security.

Testing

Tested locally with hermes dashboard --no-open --tui --host 0.0.0.0 --insecure over Tailscale - WebSocket Chat tab now works correctly from remote clients.

…cure is used

When using 'hermes dashboard --insecure --host 0.0.0.0', the HTTP page
loads fine over Tailscale/remote connections, but the WebSocket endpoints
(/api/pty, /api/ws, /api/pub, /api/events) still rejected non-loopback
clients with code 4403 (Forbidden).

This caused 'Session ended' errors in the Chat tab when accessing the
dashboard remotely via Tailscale, even though --insecure was passed.

The fix stores the allow_public flag in app.state and checks it before
rejecting non-loopback WebSocket connections. The default behavior
(loopback-only) remains unchanged for security.

Fixes: WebSocket Chat tab not working over Tailscale with --insecure flag
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 29, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Closing as already fixed on main.

Triage notes (high confidence):
Main hermes_cli/web_server.py:3304 _ws_client_is_allowed already returns True when _is_public_bind() (host bound to 0.0.0.0/::), which is the --insecure case — the WebSocket loopback gate the PR targets is no longer there.

If you still see this on the latest version, please reopen with reproduction steps.

(Bulk-closed during a CLI triage sweep.)

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

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants