GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@netty-project-bot

@netty-project-bot netty-project-bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@husseinvr97 @chrisvest @netty-project-bot
Validate chunked-must-be-last regardless of HTTP version (#17055)
cd3a489
### 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)
@netty-project-bot netty-project-bot mentioned this pull request Aug 6, 2026
Validate chunked-must-be-last regardless of HTTP version #17055
Merged
@chrisvest chrisvest added this to the 4.1.138.Final milestone Aug 6, 2026
@chrisvest
chrisvest enabled auto-merge (squash) August 6, 2026 23:30
@normanmaurer
normanmaurer disabled auto-merge August 7, 2026 05:28
@normanmaurer
normanmaurer merged commit 09f5588 into 4.1 Aug 7, 2026
17 of 18 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
normanmaurer deleted the auto-port-pr-17055-to-4.1 branch August 7, 2026 05:28
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
@netty-project-bot @husseinvr97
@chrisvest @lltopk
Auto-port 4.1: Validate chunked-must-be-last regardless of HTTP versi…
d67193a
…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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.1.138.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@netty-project-bot @chrisvest @normanmaurer @husseinvr97
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.