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 — Don't count STOMP headers again when the header block is replayed by allthingssecurity · Pull Request #17664 · netty/netty Conversation
Contributor
Motivation:
As a result, whether a valid frame is rejected with "maximum number of headers exceeded" depends on how it is split into reads. After the rejection, the decoder stays in
Modification:
Result:
The problem was found by modelling the replay behaviour of the decoder in Lean 4 and reproducing it with the real class. The change was prepared with Claude Code (Claude Opus 5.5), and the commit has a Prepared with Claude Code on behalf of allthingssecurity. 🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsMotivation: StompSubframeDecoder is a ReplayingDecoder. When the headers of a frame are not complete yet, the next read parses all of them again from the checkpoint. The header counter that enforces maxNumHeaders was only reset by the empty line that ends the headers, so every replay added the headers that were already counted. Whether a valid frame was rejected with "maximum number of headers exceeded" depended on how it was split into reads (for example 15 headers sent byte by byte, or a frame at the limit in two reads), and the decoder then stayed in BAD_FRAME. Modification: Reset the counter each time the header block is parsed and add tests. Result: maxNumHeaders applies to the headers of a frame, independent of how the frame is split into reads. Co-Authored-By: Claude Opus 5.5 <[email protected]>
normanmaurer
requested changes
Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Motivation: The two new tests looped over the read sizes inside one test method. Modification: Turn them into @ParameterizedTest methods with the read sizes as a @valuesource. Result: Each read size is reported as its own test case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
There was an error while loading. Please reload this page.
🚨 TestLens detected 1 failed test 🚨Here is what you can do:
Test SummaryBuild PR / linux-x86_64-java26 build > Netty/Codec/HTTP2
🏷️ Commit: c716586 Test FailuresHttp2MultiplexTransportTest (Netty/Codec/HTTP2 in Build PR / linux-x86_64-java26 build)Rerun ControlsNote Checks are currently running using the configuration below. Select tests to mute in this pull request: 🔲 Http2MultiplexTransportTest Reuse successful test results: 🔲 ♻️ Only rerun the tests that failed or were muted before Click the checkbox to trigger a rerun: 🔲 Rerun jobs 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.
|
Could not create auto-port PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Actually this is not needed for 5.0 as it is not using |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Auto-port PR for 4.1: #17716 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…is replayed (#17716) Auto-port of #17664 to 4.1 Cherry-picked commit: f364155 --- Motivation: `StompSubframeDecoder` is a `ReplayingDecoder`. When the header block of a frame is not complete, the next read parses the command and all headers again from the checkpoint. The counter that enforces `maxNumHeaders` (`HeaderParser.numHeaders`, added in #17063) is only reset by the empty line that ends the headers. So every replay adds the headers that were already counted. As a result, whether a valid frame is rejected with "maximum number of headers exceeded" depends on how it is split into reads. After the rejection, the decoder stays in `BAD_FRAME`. With the default limit of 128: | Frame | Reads | Result | |---|---|---| | 15 headers | sent byte by byte, or one line at a time from a terminal | rejected | | 40 headers | 32-byte reads | rejected | | 128 headers | 2 reads | rejected | | 90 headers | one read | accepted | Modification: - Reset the counter at the start of `readHeaders()`. Each attempt parses all headers of the frame again, so it counts from zero. - New tests in `StompSubframeDecoderTest`, each with `maxNumHeaders = 10` and read sizes of 1, 7, about half the frame and the whole frame: - `testMaxNumHeadersNotExceededWhenHeadersSplitAcrossReads`: a frame with 10 headers is accepted. - `testMaxNumHeadersEnforcedWhenHeadersSplitAcrossReads`: a frame with 11 headers is rejected. Result: `maxNumHeaders` limits the headers of a frame, however the frame is split into reads. The limit itself is unchanged: each attempt still counts every header of the frame. Co-authored-by: allthingssecurity <[email protected]> Co-authored-by: Norman Maurer <[email protected]>
…is replayed (netty#17716) Auto-port of netty#17664 to 4.1 Cherry-picked commit: f364155 --- Motivation: `StompSubframeDecoder` is a `ReplayingDecoder`. When the header block of a frame is not complete, the next read parses the command and all headers again from the checkpoint. The counter that enforces `maxNumHeaders` (`HeaderParser.numHeaders`, added in netty#17063) is only reset by the empty line that ends the headers. So every replay adds the headers that were already counted. As a result, whether a valid frame is rejected with "maximum number of headers exceeded" depends on how it is split into reads. After the rejection, the decoder stays in `BAD_FRAME`. With the default limit of 128: | Frame | Reads | Result | |---|---|---| | 15 headers | sent byte by byte, or one line at a time from a terminal | rejected | | 40 headers | 32-byte reads | rejected | | 128 headers | 2 reads | rejected | | 90 headers | one read | accepted | Modification: - Reset the counter at the start of `readHeaders()`. Each attempt parses all headers of the frame again, so it counts from zero. - New tests in `StompSubframeDecoderTest`, each with `maxNumHeaders = 10` and read sizes of 1, 7, about half the frame and the whole frame: - `testMaxNumHeadersNotExceededWhenHeadersSplitAcrossReads`: a frame with 10 headers is accepted. - `testMaxNumHeadersEnforcedWhenHeadersSplitAcrossReads`: a frame with 11 headers is rejected. Result: `maxNumHeaders` limits the headers of a frame, however the frame is split into reads. The limit itself is unchanged: each attempt still counts every header of the frame. Co-authored-by: allthingssecurity <[email protected]> Co-authored-by: Norman Maurer <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.