mirror of
https://github.com/oven-sh/bun
synced 2026-02-18 06:41:50 +00:00
The WebSocket upgrade client checked that the Sec-WebSocket-Accept header was present but never validated its value against the expected SHA-1 hash of the client's Sec-WebSocket-Key concatenated with the RFC 6455 magic GUID. This allowed a MitM attacker to fake a WebSocket handshake with any arbitrary accept value. Store the expected accept value (computed during request construction) on the client struct and validate it against the server's response during the upgrade handshake. Co-Authored-By: Claude <noreply@anthropic.com>