Files
multica/server/internal/realtime
Bohan Jiang f4bf8e2c36 fix(realtime): bound inbound WebSocket message size (MUL-5569) (#6222)
The client-facing realtime hub upgraded a connection and read from it
without ever calling SetReadLimit, so gorilla buffered a whole inbound
message in memory before any application-level check ran. A fragmented
message with interleaved pong frames keeps refreshing the read deadline,
so a single connection could grow that buffer without bound and OOM the
process, taking every workspace on the instance down with it.

Set a 64 KiB limit — matching the daemon hub, three orders of magnitude
above the largest legitimate frame — immediately after the upgrade rather
than in readPump: the token auth path reads its first frame before the
caller is authenticated, so a limit installed any later leaves that read
unbounded. Over-limit closes get their own counter on both paths so the
breach stays visible instead of blending into ordinary churn.

Closes #6210

Co-authored-by: Bohan-J <bohan@devv.ai>
Co-authored-by: multica-agent <github@multica.ai>
2026-07-31 13:38:57 +08:00
..