-
Notifications
You must be signed in to change notification settings - Fork 756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limiting message size #1037
Comments
The message size can be limited when implementing the // ...
public function onMessage(ConnectionInterface $from, $msg)
{
if (strlen($msg) > 4096) {
return;
}
// ...
}
// ... |
This does not fix the issue as the memory has already been consumed before onMessage is called. This needs to be done in Ratchet itself. The following commit hardcodes a limit of 1000 bytes and solves the issue, ideally that would be some kind of configuration option. |
😉 That's the frame size in WebSocket parlance I suppose. |
Is there any way to limit maximum websocket message size with Ratchet? As it is, an attacker can just send a 100MB message on a bunch of concurrent connections and effectively bring the server down due to memory exhaustion.
Thanks!
The text was updated successfully, but these errors were encountered: