-
Notifications
You must be signed in to change notification settings - Fork 22
Avoid exposing API keys in WebSocket query strings #29
Description
API key exposed in WebSocket URL query string
The API key is appended as a plain query parameter to the WebSocket URL. Query parameters appear in server access logs (standard HTTP request-line logging), reverse-proxy/CDN access logs, and network inspection tools.
All other authenticated requests use the x-claw-key header, which does not appear in standard server access log formats. Since the WS upgrade is itself an HTTP request, the header-based approach would work there too — most WebSocket libraries let you pass custom headers via the headers option when the connection originates from a Node.js client.
For browser-based clients where custom upgrade headers are not available, a common approach is a short-lived token handshake: obtain a one-time token from a normal authenticated REST endpoint, then pass only that ephemeral token in the WS query string. This keeps the real credential out of logs entirely.
Originally posted by @greptile-apps[bot] in #23 (comment)