GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Http2: reject generic frames whose payload exceeds SETTINGS_MAX_FRAME_SIZE by AbhishekShukla1289 · Pull Request #17779 · netty/netty Conversation
Contributor
Motivation: RFC 9113 Section 4.2 applies SETTINGS_MAX_FRAME_SIZE to the payload Modification:
Result: Generic frames can no longer exceed the frame size negotiated with Fixes #17426
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…E_SIZE Motivation: RFC 9113 Section 4.2 applies SETTINGS_MAX_FRAME_SIZE to the payload of every frame. The typed writers in DefaultHttp2FrameWriter honour the limit advertised by the remote peer: writeData splits large payloads into multiple DATA frames and writeHeaders uses CONTINUATION. The generic writeFrame(...) path does not check the limit and writes the full payload length into a single frame header, so it can emit a frame that a compliant peer must reject with FRAME_SIZE_ERROR. Modification: - Verify the payload length against maxFrameSize in writeFrame before allocating the frame header. A generic frame has unknown semantics and cannot be split, so the write fails instead: the payload is released and the promise is failed with an IllegalArgumentException, consistent with the other verify* checks in this class. - Add tests for a payload of maxFrameSize + 1 (rejected, nothing written, payload released) and of exactly maxFrameSize (written). The first fails without the change and passes with it. Result: Generic frames can no longer exceed the frame size negotiated with the remote peer. codec-http2 tests: 1633, 0 failures. Fixes netty#17426 …E_SIZE Motivation: RFC 9113 Section 4.2 applies SETTINGS_MAX_FRAME_SIZE to the payload of every frame. The typed writers in DefaultHttp2FrameWriter honour the limit advertised by the remote peer: writeData splits large payloads into multiple DATA frames and writeHeaders uses CONTINUATION. The generic writeFrame(...) path does not check the limit and writes the full payload length into a single frame header, so it can emit a frame that a compliant peer must reject with FRAME_SIZE_ERROR. Modification: - Verify the payload length against maxFrameSize in writeFrame before allocating the frame header. A generic frame has unknown semantics and cannot be split, so the write fails instead: the payload is released and the promise is failed with an IllegalArgumentException, consistent with the other verify* checks in this class. - Add tests for a payload of maxFrameSize + 1 (rejected, nothing written, payload released) and of exactly maxFrameSize (written). The first fails without the change and passes with it. Result: Generic frames can no longer exceed the frame size negotiated with the remote peer. codec-http2 tests: 1633, 0 failures. This change was drafted with AI assistance; I reviewed, tested, and verified it locally. Fixes netty#17426
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
bryce-anderson
approved these changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Approved because this is definitely a step forward but I'd love it if you sealed off the other two cases that remain open.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to include the frame type in the message, especially if you use this for other frame types.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Uh oh!
There was an error while loading. Please reload this page.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you think about truncating the payload if it exceeds the max frame size? If it were another frame, I'd suggest we reject it, but a GOAWAY feels like a must send type of frame so a warning that the debug data was truncated and then truncate feels like the right thing to do here.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 to what @bryce-anderson suggested
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. …/AbhishekShukla1289/netty into fix-17426-generic-frame-max-size …runcate GOAWAY debug data
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
Some notes on the update:
Quick q: I went with warn for the truncation log. Would debug be better so busy servers don't get spammed? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
One last nit. Thank you!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…Http2FrameWriter.java Co-authored-by: Bryce Anderson <[email protected]>
There was an error while loading. Please reload this page.
🚨 TestLens detected 1 failed test 🚨Test SummaryTip Inspect all details with the TestLens CLI: Build PR / macos-aarch64-java11-boringssl build > Netty/Transport/Native/KQueue
🏷️ Commit: 916ef18 Test FailuresKQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithConnect(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-aarch64-java11-boringssl build)Rerun ControlsSelect tests to mute in this pull request:
Reuse successful test results:
Click the checkbox to trigger a rerun:
Learn more about TestLens at testlens.app/docs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Auto-port PR for 4.1: #18000 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Auto-port PR for 5.0: #18001 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Motivation: The auto-port of #17779 does not compile on 5.0 as it was written against the 4.x API. Modification: - Use a short frame type in DefaultHttp2FrameWriter.verifyPayloadLength as writeFrame takes a short on 5.0, and mask it with 0xFFFF when formatting. - Adjust the new tests to the 5.0 API: the writers return void, so assert on the passed Promise instead of a ChannelFuture, and match the CompletionHandler based write. Result: codec-http2 compiles again and DefaultHttp2FrameWriterTest passes.
…TINGS_MAX_FRAME_SIZE (#18001) Auto-port of #17779 to 5.0 Cherry-picked commit: dc5655e --- Motivation: RFC 9113 Section 4.2 applies SETTINGS_MAX_FRAME_SIZE to the payload of every frame. The typed writers in DefaultHttp2FrameWriter honour the limit advertised by the remote peer: writeData splits large payloads into multiple DATA frames and writeHeaders uses CONTINUATION. The generic writeFrame(...) path does not check the limit and writes the full payload length into a single frame header, so it can emit a frame that a compliant peer must reject with FRAME_SIZE_ERROR. Modification: - Verify the payload length against maxFrameSize in writeFrame before allocating the frame header. A generic frame has unknown semantics and cannot be split, so the write fails instead: the payload is released and the promise is failed with an IllegalArgumentException, consistent with the other verify* checks in this class. - Add tests for a payload of maxFrameSize + 1 (rejected, nothing written, payload released) and of exactly maxFrameSize (written). The first fails without the change and passes with it. Result: Generic frames can no longer exceed the frame size negotiated with the remote peer. codec-http2 tests: 1633, 0 failures. Fixes #17426 --------- Co-authored-by: Abhishek Shukla <[email protected]> Co-authored-by: Netty Project Bot <[email protected]> Co-authored-by: Norman Maurer <[email protected]> Co-authored-by: Bryce Anderson <[email protected]>
…TINGS_MAX_FRAME_SIZE (#18000) Auto-port of #17779 to 4.1 Cherry-picked commit: dc5655e --- Motivation: RFC 9113 Section 4.2 applies SETTINGS_MAX_FRAME_SIZE to the payload of every frame. The typed writers in DefaultHttp2FrameWriter honour the limit advertised by the remote peer: writeData splits large payloads into multiple DATA frames and writeHeaders uses CONTINUATION. The generic writeFrame(...) path does not check the limit and writes the full payload length into a single frame header, so it can emit a frame that a compliant peer must reject with FRAME_SIZE_ERROR. Modification: - Verify the payload length against maxFrameSize in writeFrame before allocating the frame header. A generic frame has unknown semantics and cannot be split, so the write fails instead: the payload is released and the promise is failed with an IllegalArgumentException, consistent with the other verify* checks in this class. - Add tests for a payload of maxFrameSize + 1 (rejected, nothing written, payload released) and of exactly maxFrameSize (written). The first fails without the change and passes with it. Result: Generic frames can no longer exceed the frame size negotiated with the remote peer. codec-http2 tests: 1633, 0 failures. Fixes #17426 Co-authored-by: Abhishek Shukla <[email protected]> Co-authored-by: Netty Project Bot <[email protected]> Co-authored-by: Norman Maurer <[email protected]> Co-authored-by: Bryce Anderson <[email protected]>
…TINGS_MAX_FRAME_SIZE (netty#18000) Auto-port of netty#17779 to 4.1 Cherry-picked commit: dc5655e --- Motivation: RFC 9113 Section 4.2 applies SETTINGS_MAX_FRAME_SIZE to the payload of every frame. The typed writers in DefaultHttp2FrameWriter honour the limit advertised by the remote peer: writeData splits large payloads into multiple DATA frames and writeHeaders uses CONTINUATION. The generic writeFrame(...) path does not check the limit and writes the full payload length into a single frame header, so it can emit a frame that a compliant peer must reject with FRAME_SIZE_ERROR. Modification: - Verify the payload length against maxFrameSize in writeFrame before allocating the frame header. A generic frame has unknown semantics and cannot be split, so the write fails instead: the payload is released and the promise is failed with an IllegalArgumentException, consistent with the other verify* checks in this class. - Add tests for a payload of maxFrameSize + 1 (rejected, nothing written, payload released) and of exactly maxFrameSize (written). The first fails without the change and passes with it. Result: Generic frames can no longer exceed the frame size negotiated with the remote peer. codec-http2 tests: 1633, 0 failures. Fixes netty#17426 Co-authored-by: Abhishek Shukla <[email protected]> Co-authored-by: Netty Project Bot <[email protected]> Co-authored-by: Norman Maurer <[email protected]> Co-authored-by: Bryce Anderson <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Generic writeFrame can emit frames over SETTINGS_MAX_FRAME_SIZE
There was an error while loading. Please reload this page.