Skip to content

Security: count each WebSocket fragment toward the message limit - #582

Merged
SandObserver merged 1 commit into
mainfrom
security/websocket-fragment-floor
Oct 27, 2026
Merged

SandObserver merged 1 commit into
mainfrom
security/websocket-fragment-floor

Conversation

@SandObserver

Copy link
Copy Markdown
Owner

Summary

  • Count every kept WebSocket fragment as at least 1 KiB toward the message limit in wrapSocket, so a server that streams empty or 1-byte continuation frames ends the session with Response too large instead of exhausting the API heap.
  • Keep the byte count used to join the message separate from that budget.

Testing
All green. Added a test that 2,000 empty continuation frames end the session at a 1 MiB limit.

Changelog

Checklist

  • Stays within the project constraints: one container, no runtime dependencies, no build step (see CONTRIBUTING.md).
  • Tests added or updated for new logic, and the full suite, lint, and typechecks pass.
  • Docs updated if behavior or configuration changed.

Each kept fragment counts at least 1 KiB, so empty or 1-byte continuation frames end the session at the size limit instead of growing the heap.
@SandObserver SandObserver added the security Security fix label Oct 27, 2026
@SandObserver
SandObserver merged commit 3b96c44 into main Oct 27, 2026
6 checks passed
@SandObserver
SandObserver deleted the security/websocket-fragment-floor branch October 27, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Security fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant