You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pass a message size limit to the stream command decoder
Bump github.com/centrifugal/protocol to v0.21.0, which now requires a
positive message size limit when constructing a stream command decoder
(GetStreamCommandDecoder, the unbounded shortcut, was removed). An
unbounded decoder over untrusted input can be driven to allocate
arbitrary memory by a single frame declaring a huge length. See
GHSA-4r3x-2rwr-6w65.
HandleReadFrame now takes a messageSizeLimit and passes it to
GetStreamCommandDecoderLimited, so an oversized declared length is
rejected before it is allocated. Each transport supplies its own limit,
coerced to a positive default:
- WebSocket: MessageSizeLimit, or DecompressedMessageSizeLimit when
compression is enabled (the decoder sees decoded bytes).
- SSE / HTTP-stream: MaxRequestBodySize.
- Emulation: the length of the already-buffered command bytes, which a
single command cannot exceed.
All coercions use <= 0 so a negative config cannot reach the decoder.
0 commit comments