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 — Auto-port 4.1: Validate chunked-must-be-last regardless of HTTP version by netty-project-bot · Pull Request #17228 · netty/netty Conversation
Contributor
Auto-port of #17055 to 4.1 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### 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: Chris Vest <[email protected]> (cherry picked from commit fcf427d)
chrisvest
enabled auto-merge (squash)
normanmaurer
disabled auto-merge
Uh oh!
There was an error while loading. Please reload this page.
lltopk
pushed a commit
to lltopk/netty
that referenced
this pull request
…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]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |