ReviewOS

home-lang/home

Bun parity: enforce compressed WebSocket maxPayloadLength

#399
Closed chris opened this 10 days ago ·
10 days ago

Parent: #66\nPredecessor: #398\n\nUpstream position 4212: js/web/websocket/websocket-permessage-deflate.test.ts.\n\nGap: compressed client messages inflated through Bun.serve's fast path bypassed websocket.maxPayloadLength and were delivered instead of causing an abnormal connection drop.\n\nContracts:\n- enforce the configured limit against decompressed client-to-server bytes\n- preserve the 16 MiB Bun default and integer/u32 boundary semantics\n- do not invoke the message handler for oversized payloads\n- notify the server close handler and client with abnormal close code 1006\n- retain a structured internal WebSocketServerMessageTooBigError with operation, phase, original RangeError cause, byte fields, limit, and composed source stack\n- permanently pin the exact upstream file and diagnostic regression\n\nAcceptance: exact file passes 6 active tests with its one upstream skip retained; positions 4202-4212 pass 67 active tests with zero failures/unsupported/allowed-empty.

10 days ago

Completed by 91a89ae (fix(websocket): enforce server payload limits).\n\nThe Bun.serve receive path now applies maxPayloadLength to the decompressed message size, drops oversized connections abnormally with 1006, suppresses message delivery, invokes the server close hook, and retains structured internal diagnostics with the original cause and byte/limit fields.\n\nVerification:\n- exact upstream position 4212: 6 passed, 1 upstream-declared skip/todo, 0 failed/unsupported/allowed-empty\n- contiguous positions 4202-4212: 11 files, 67 passed, 1 upstream todo, all other non-pass buckets zero\n- permanent exact-file and structured-error regressions: passed\n- zig fmt --check and git diff --check: passed\n\nContinues #398 and advances #66.

Sign in to comment on this issue.