Skip to main content
← Back to list
01Issue
FeatureShippedSwamp CLI
Assigneesstack72

Relationships

#1119 WS handshake accepts the token **only** as a URL query parameter

Opened by ehazlett · 7/13/2026· Shipped 7/13/2026

Problem Statement

swamp serve --auth-mode token authenticates the WebSocket handshake from
?token=<name>.<secret> in the request path. We probed all four plausible
transports against a live server:

| Transport | Result | g
| --- | --- | | no token | HTTP/1.1 401 Unauthorized | | GET /?token=… | HTTP/1.1 101 Switching Protocols | | Authorization: Bearer … | HTTP/1.1 401 Unauthorized | | Sec-WebSocket-Protocol: bearer.… | HTTP/1.1 401 Unauthorized |

Why this matters. Query strings are logged by default — reverse proxies (nginx $request_uri, envoy, ALB access logs), browser history, Referer headers, and shell history.

The asymmetry is notable: the documented REST endpoint (POST /api/v1/cancel/:type/:id) does take Authorization: Bearer. So the codebase already speaks header auth — just not at the WS upgrade.

Proposed Solution

Ask: accept Authorization: Bearer <token> on the WS upgrade request, and keep the query param as a deprecated fallback. Browsers can't set headers on new WebSocket(), so also consider the Sec-WebSocket-Protocol convention for browser clients.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 4 MOREPR_MERGED+ 1 MORECONTRIBUTOR_NOTIFIED

Shipped

7/13/2026, 10:52:10 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack727/13/2026, 9:00:09 PM
Editable. Press Enter to edit.

stack72 commented 7/13/2026, 10:52:18 PM

Thanks @ehazlett for reporting this! The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.