Repository navigation
Conversation
A frame announces its length and its payload follows; mist kept buffering until the frame was whole, so a peer announcing a huge frame could grow the buffer until the node ran out of memory. Past 1 MiB of unfinished frame the connection is now closed, with a warning in the log.
Author
|
Closing in favour of #92 , which fixes the same issue more completely (the declared length is checked before buffering, fragmented messages have a shared limit, the limits are configurable). I'll follow that one instead. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A WebSocket frame says how long it is in its header, and mist keeps buffering until the whole frame has arrived. A client that announces a very large frame and keeps sending can grow one connection's buffer until the node runs out of memory.
This closes the connection once more than 1 MiB of an unfinished frame is waiting, and logs a warning. Frames under the limit are unaffected.
The limit is a constant for now; happy to make it configurable (e.g. on the websocket builder) if you'd prefer.
Notes, both on master as well and unrelated to this change:
http1_test.it_rejects_large_requests_testfails for me (macOS).gleam format --checkflagssrc/mist/internal/http2/frame.gleam; I left it untouched to keep this PR to the fix.