Skip to content

Avoid exposing API keys in WebSocket query strings #29

@dreamwing

Description

@dreamwing

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions