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 — Validate chunked-must-be-last regardless of HTTP version by husseinvr97 · Pull Request #17055 · netty/netty

Conversation

@husseinvr97

@husseinvr97 husseinvr97 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

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 husseinvr97 changed the title Title: Validate chunked-must-be-last regardless of HTTP version Validate chunked-must-be-last regardless of HTTP version Jul 5, 2026
@normanmaurer
normanmaurer requested review from bryce-anderson and idelpivnitskiy July 8, 2026 00:06
normanmaurer
normanmaurer requested changes Jul 8, 2026
View reviewed changes
Comment thread codec-http/src/test/java/io/netty/handler/codec/http/HttpRequestDecoderTest.java Resolved

Uh oh!

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

Comment thread codec-http/src/test/java/io/netty/handler/codec/http/HttpRequestDecoderTest.java Resolved

Uh oh!

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

@idelpivnitskiy
idelpivnitskiy requested a review from daschl July 8, 2026 01:34
@husseinvr97
husseinvr97 force-pushed the fix/transfer-encoding-chunked-last-http-version-scope branch from ccbd1b3 to fb99460 Compare July 8, 2026 06:10
@husseinvr97

husseinvr97 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

The linux-x86_64-java11-boringssl job has been running for 5+ hours while every other job in this run finished normally (30-65 min). I don't have permission to cancel or re-run it myself — could someone with access take a look, or re-trigger it?

All reactions

Sorry, something went wrong.

Uh oh!

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

@husseinvr97
husseinvr97 requested a review from normanmaurer July 8, 2026 11:33
bryce-anderson
bryce-anderson approved these changes Jul 8, 2026
View reviewed changes

@bryce-anderson bryce-anderson left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The 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 reactions
Comment thread codec-http/src/test/java/io/netty/handler/codec/http/HttpRequestDecoderTest.java Resolved

Uh oh!

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

@bryce-anderson

bryce-anderson commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

There is a persistently (consistently?) flaky test but it appears unrelated to this PR:

DataCompressionHttp2Test.encodingTooBigMessage:252->testEncodingMessage:310 expected: <true> but was: <false>

https://github.com/netty/netty/actions/runs/28921625575/job/85910442686?pr=17055#step:9:10855

All reactions

Sorry, something went wrong.

Uh oh!

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

@husseinvr97
Make 'chunked must be last encoding' check version-independent
f79947b
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
husseinvr97 force-pushed the fix/transfer-encoding-chunked-last-http-version-scope branch from fb99460 to f79947b Compare July 8, 2026 16:31
chrisvest
chrisvest approved these changes Jul 23, 2026
View reviewed changes
@chrisvest chrisvest added this to the 4.2.17.Final milestone Jul 23, 2026
@chrisvest chrisvest added needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Jul 23, 2026
@chrisvest
Merge branch '4.2' into fix/transfer-encoding-chunked-last-http-versi…
26d1e35
…on-scope
@chrisvest
chrisvest enabled auto-merge (squash) July 23, 2026 22:28
@testlens-app

testlens-app Bot commented Jul 23, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

🚨 TestLens detected 1 failed test 🚨

Here is what you can do:

  1. Inspect the test failures carefully.
  2. If you are convinced that some of the tests are flaky, you can mute them below.
  3. Finally, trigger a rerun by checking the rerun checkbox.

Test Summary

Build PR / macos-x86_64-java11-boringssl build > Netty/Transport/Native/KQueue

Test Runs Flakiness
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo) ❌ 25% 🔴

🏷️ Commit: 26d1e35
▶️ Tests: 40568 executed
⚪️ Checks: 18/18 completed

Test Failures

KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-x86_64-java11-boringssl build)
org.opentest4j.AssertionFailedError
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend0(DatagramUnicastTest.java:360)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend(DatagramUnicastTest.java:192)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendCompositeDirectByteBuf(DatagramUnicastTest.java:126)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$3.run(DatagramUnicastTest.java:112)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$3.run(DatagramUnicastTest.java:109)
	at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendCompositeDirectByteBuf(DatagramUnicastTest.java:109)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)

Muted Tests

Select tests to mute in this pull request:

  • KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo)

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.

All reactions

Sorry, something went wrong.

Uh oh!

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

@chrisvest chrisvest modified the milestones: 4.2.17.Final, 4.2.18.Final Aug 4, 2026
@chrisvest
chrisvest disabled auto-merge August 6, 2026 22:45
@chrisvest
chrisvest merged commit fcf427d into netty:4.2 Aug 6, 2026
17 of 19 checks passed

Uh oh!

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

@chrisvest

chrisvest commented Aug 6, 2026

Copy link
Copy Markdown
Member

Thanks!

husseinvr97 reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

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

@netty-project-bot

netty-project-bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #17227

All reactions

Sorry, something went wrong.

Uh oh!

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

@netty-project-bot netty-project-bot mentioned this pull request Aug 6, 2026
Auto-port 5.0: Validate chunked-must-be-last regardless of HTTP version #17227
Merged
@netty-project-bot

netty-project-bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 4.1: #17228

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot removed needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. labels Aug 6, 2026
@netty-project-bot netty-project-bot mentioned this pull request Aug 6, 2026
Auto-port 4.1: Validate chunked-must-be-last regardless of HTTP version #17228
Merged
chrisvest added a commit that referenced this pull request Aug 7, 2026
@netty-project-bot @husseinvr97 @chrisvest
Auto-port 5.0: Validate chunked-must-be-last regardless of HTTP versi…
e93e3f2
…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]>
normanmaurer pushed a commit that referenced this pull request Aug 7, 2026
@netty-project-bot @husseinvr97 @chrisvest
Auto-port 4.1: Validate chunked-must-be-last regardless of HTTP versi…
09f5588
…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]>
@normanmaurer normanmaurer mentioned this pull request Oct 1, 2026
child5 #17695
Closed
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]>
@normanmaurer normanmaurer mentioned this pull request Oct 26, 2026
crisp nova cceda091 #18109
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chrisvest chrisvest chrisvest approved these changes
@bryce-anderson bryce-anderson bryce-anderson approved these changes
@idelpivnitskiy idelpivnitskiy Awaiting requested review from idelpivnitskiy
@daschl daschl Awaiting requested review from daschl
@normanmaurer normanmaurer Awaiting requested review from normanmaurer

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.2.18.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

5 participants

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