Skip to content

Change default max_frame_size#22

Merged
mtrudel merged 2 commits intophoenixframework:mainfrom
dlindenkreuz:add-default-max-frame-size
Apr 15, 2026
Merged

Change default max_frame_size#22
mtrudel merged 2 commits intophoenixframework:mainfrom
dlindenkreuz:add-default-max-frame-size

Conversation

@dlindenkreuz
Copy link
Copy Markdown
Contributor

Currently, WebSockAdapter applies a default documented limit of :infinity on incoming WebSocket frame size. This leaves default setups unprotected against malicious oversized payloads unless they explicitly configure max_binary_size on the socket transport.

(More specifically, the default value is not specified and is left to the underlying web servers like Bandit)

This is inconsistent with the long polling transport for Phoenix Channels, where incoming event messages are limited to 10MB (currently hardcoded).

This PR changes the default max_frame_size to 10MB to match the limit already in place for long polling. Applications that need to support larger frames can opt out by raising or removing the limit explicitly.

Strictly speaking, this would be a breaking change, but then again, web socket frames >10MB are not that common. WDYT?

@mtrudel
Copy link
Copy Markdown
Member

mtrudel commented Apr 15, 2026

I think this is fine to merge as-is

@mtrudel
Copy link
Copy Markdown
Member

mtrudel commented Apr 15, 2026

I'll get the failing test fixed up this evening (if you don't get to it first) and we'll get this out!

@mtrudel mtrudel merged commit 0106951 into phoenixframework:main Apr 15, 2026
@dlindenkreuz dlindenkreuz deleted the add-default-max-frame-size branch April 20, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants