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 — Validate chunked-must-be-last regardless of HTTP version by husseinvr97 · Pull Request #17055 · netty/netty Conversation
Contributor
MotivationRFC 9112 §6.1 requires that when a message uses Transfer-Encoding, "chunked" must be the last encoding listed — a value like Under the default configuration this is harmless: an earlier guard already rejects any Transfer-Encoding header on a non-1.1 message outright, so the ordering check's version scoping is not expected to be exercised under normal use. However, Modification
Result
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
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.
husseinvr97
force-pushed
the
fix/transfer-encoding-chunked-last-http-version-scope
branch
from
ccbd1b3 to
fb99460
Compare
Contributor
Author
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. Code looks good but the comments are a bit excessive. Could they be trimmed down a bit before merging?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. The RFC 9112 6.1 validation that 'chunked' must be the last encoding in a Transfer-Encoding header was nested inside a pre-existing protocolVersion() == HTTP_1_1 condition that gated a different, older check (the Content-Length/Transfer-Encoding conflict handling added for CVE-2026-42581). Since the ordering rule itself has no dependency on protocol version, and HttpDecoderConfig#setUseRfc9112TransferEncoding(false) is a documented opt-out that allows a non-1.1 message to legitimately carry Transfer-Encoding, the inherited version gate meant this validation was silently skipped for HTTP/1.0 (and other non-1.1 versions) under that configuration. Fixed by giving the ordering check its own version-independent condition. The Content-Length-conflict check's own HTTP_1_1 scoping is unchanged. Signed-off-by: husseinvr97 <[email protected]>
husseinvr97
force-pushed
the
fix/transfer-encoding-chunked-last-http-version-scope
branch
from
fb99460 to
f79947b
Compare
chrisvest
approved these changes
chrisvest
enabled auto-merge (squash)
|
There was an error while loading. Please reload this page.
🚨 TestLens detected 1 failed test 🚨Here is what you can do:
Test SummaryBuild PR / macos-x86_64-java11-boringssl build > Netty/Transport/Native/KQueue
🏷️ Commit: 26d1e35 Test FailuresKQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-x86_64-java11-boringssl build)Muted TestsSelect 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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Auto-port PR for 5.0: #17227 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Auto-port PR for 4.1: #17228 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…on (#17227) Auto-port of #17055 to 5.0 Cherry-picked commit: fcf427d --- ### Motivation RFC 9112 §6.1 requires that when a message uses Transfer-Encoding, "chunked" must be the last encoding listed — a value like `chunked, identity` is malformed. This rule was added to `HttpObjectDecoder` alongside the fix for CVE-2026-42581, nested inside a pre-existing `protocolVersion() == HttpVersion.HTTP_1_1` condition — the same condition that gates a different, older check (the Content-Length/Transfer-Encoding conflict handling). Under the default configuration this is harmless: an earlier guard already rejects any Transfer-Encoding header on a non-1.1 message outright, so the ordering check's version scoping is not expected to be exercised under normal use. However, `HttpDecoderConfig#setUseRfc9112TransferEncoding(false)` is a documented opt-out for restoring RFC 7230 behavior, and under that configuration a non-1.1 message can legitimately carry Transfer-Encoding without being rejected for it. In that case, the inherited version gate meant the chunked-must-be-last check was silently skipped for HTTP/1.0 (and other non-1.1 versions) — a message with `Transfer-Encoding: chunked, identity` would decode successfully instead of being rejected. ### Modification - Extracted the chunked-must-be-last check from inside the `protocolVersion() == HTTP_1_1` block in `HttpObjectDecoder#readHeaders` and gave it its own, version-independent condition, since the RFC 9112 ordering rule has no dependency on protocol version. - Added two regression tests to `HttpRequestDecoderTest`: one reproducing the original scenario (HTTP/1.0, `useRfc9112TransferEncoding(false)`, `Transfer-Encoding: chunked, identity)`, and a companion using a non-no-op trailing encoding (`chunked, gzip`) confirming the fix isn't tied to the specific encoding that follows `chunked`. - Corrected a pre-existing inaccuracy in `handleTransferEncodingChunkedWithContentLength`'s javadoc, which stated that earlier HTTP versions "will reject requests that include [Transfer-Encoding]" without qualification — true only under the default configuration, and already inaccurate before this change since `useRfc9112TransferEncoding(false)` predates it. ### Result - The chunked-must-be-last validation now applies to any message carrying a Transfer-Encoding header, independent of protocol version or the `useRfc9112TransferEncoding` setting. --------- Signed-off-by: husseinvr97 <[email protected]> Co-authored-by: Hussein Mustafa <[email protected]> Co-authored-by: Chris Vest <[email protected]>
…on (#17228) Auto-port of #17055 to 4.1 Cherry-picked commit: fcf427d --- ### Motivation RFC 9112 §6.1 requires that when a message uses Transfer-Encoding, "chunked" must be the last encoding listed — a value like `chunked, identity` is malformed. This rule was added to `HttpObjectDecoder` alongside the fix for CVE-2026-42581, nested inside a pre-existing `protocolVersion() == HttpVersion.HTTP_1_1` condition — the same condition that gates a different, older check (the Content-Length/Transfer-Encoding conflict handling). Under the default configuration this is harmless: an earlier guard already rejects any Transfer-Encoding header on a non-1.1 message outright, so the ordering check's version scoping is not expected to be exercised under normal use. However, `HttpDecoderConfig#setUseRfc9112TransferEncoding(false)` is a documented opt-out for restoring RFC 7230 behavior, and under that configuration a non-1.1 message can legitimately carry Transfer-Encoding without being rejected for it. In that case, the inherited version gate meant the chunked-must-be-last check was silently skipped for HTTP/1.0 (and other non-1.1 versions) — a message with `Transfer-Encoding: chunked, identity` would decode successfully instead of being rejected. ### Modification - Extracted the chunked-must-be-last check from inside the `protocolVersion() == HTTP_1_1` block in `HttpObjectDecoder#readHeaders` and gave it its own, version-independent condition, since the RFC 9112 ordering rule has no dependency on protocol version. - Added two regression tests to `HttpRequestDecoderTest`: one reproducing the original scenario (HTTP/1.0, `useRfc9112TransferEncoding(false)`, `Transfer-Encoding: chunked, identity)`, and a companion using a non-no-op trailing encoding (`chunked, gzip`) confirming the fix isn't tied to the specific encoding that follows `chunked`. - Corrected a pre-existing inaccuracy in `handleTransferEncodingChunkedWithContentLength`'s javadoc, which stated that earlier HTTP versions "will reject requests that include [Transfer-Encoding]" without qualification — true only under the default configuration, and already inaccurate before this change since `useRfc9112TransferEncoding(false)` predates it. ### Result - The chunked-must-be-last validation now applies to any message carrying a Transfer-Encoding header, independent of protocol version or the `useRfc9112TransferEncoding` setting. Signed-off-by: husseinvr97 <[email protected]> Co-authored-by: Hussein Mustafa <[email protected]> Co-authored-by: Chris Vest <[email protected]>
…on (netty#17228) Auto-port of netty#17055 to 4.1 Cherry-picked commit: fcf427d --- ### Motivation RFC 9112 §6.1 requires that when a message uses Transfer-Encoding, "chunked" must be the last encoding listed — a value like `chunked, identity` is malformed. This rule was added to `HttpObjectDecoder` alongside the fix for CVE-2026-42581, nested inside a pre-existing `protocolVersion() == HttpVersion.HTTP_1_1` condition — the same condition that gates a different, older check (the Content-Length/Transfer-Encoding conflict handling). Under the default configuration this is harmless: an earlier guard already rejects any Transfer-Encoding header on a non-1.1 message outright, so the ordering check's version scoping is not expected to be exercised under normal use. However, `HttpDecoderConfig#setUseRfc9112TransferEncoding(false)` is a documented opt-out for restoring RFC 7230 behavior, and under that configuration a non-1.1 message can legitimately carry Transfer-Encoding without being rejected for it. In that case, the inherited version gate meant the chunked-must-be-last check was silently skipped for HTTP/1.0 (and other non-1.1 versions) — a message with `Transfer-Encoding: chunked, identity` would decode successfully instead of being rejected. ### Modification - Extracted the chunked-must-be-last check from inside the `protocolVersion() == HTTP_1_1` block in `HttpObjectDecoder#readHeaders` and gave it its own, version-independent condition, since the RFC 9112 ordering rule has no dependency on protocol version. - Added two regression tests to `HttpRequestDecoderTest`: one reproducing the original scenario (HTTP/1.0, `useRfc9112TransferEncoding(false)`, `Transfer-Encoding: chunked, identity)`, and a companion using a non-no-op trailing encoding (`chunked, gzip`) confirming the fix isn't tied to the specific encoding that follows `chunked`. - Corrected a pre-existing inaccuracy in `handleTransferEncodingChunkedWithContentLength`'s javadoc, which stated that earlier HTTP versions "will reject requests that include [Transfer-Encoding]" without qualification — true only under the default configuration, and already inaccurate before this change since `useRfc9112TransferEncoding(false)` predates it. ### Result - The chunked-must-be-last validation now applies to any message carrying a Transfer-Encoding header, independent of protocol version or the `useRfc9112TransferEncoding` setting. Signed-off-by: husseinvr97 <[email protected]> Co-authored-by: Hussein Mustafa <[email protected]> Co-authored-by: Chris Vest <[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.