auditing-websocket-connection-trustlisted
Install: claude install-skill UnboundCompute/security-agent-skills
# Auditing WebSocket connection trust: trust checked once at the upgrade, never per message
A WebSocket endpoint fails where it establishes trust once, at the upgrade, and never re-checks it. If the
handshake authenticates purely from an ambient cookie and does not validate the origin, any web page can
open an authenticated socket on the user's behalf (cross-site hijacking); if it authenticates at the
handshake but never authorizes individual messages, a connection can escalate mid-stream. You audit it by
resolving how the handshake authenticates (an ambient cookie, or an unpredictable token a cross-site page
cannot read) and whether the origin is enforced, then following each privileged message to see whether it
is re-authorized. A known false-positive trap lives here: an origin check delegated to a proxy is only a
defense if the proxy actually rejects, so confirm the backstop. The wss certificate check belongs to the
transport skill.
## When to use
- You are reviewing a WebSocket upgrade handler, its origin check, and its per-message dispatch.
- The endpoint authenticates at the handshake, from a cookie or a token, and then handles messages.
- You want to know whether a cross-site page or a later message can drive a privileged action.
## Scope check
Audit only endpoints you own or are authorized to assess, and open a socket or send a message only against
a service in scope, a privileged message drives real state. Adjudicate on the handshake and the dispatch.
If you can