Skip to content

Remove LF_CHUNK_TERMINATION from non-legacy HttpCompliance modes (12.0) - #15503

Merged
lachlan-roberts merged 5 commits into
jetty-12.0.xfrom
fix/jetty-12.0.x/http-compliance-modes
Jul 30, 2026
Merged

lachlan-roberts merged 5 commits into
jetty-12.0.xfrom
fix/jetty-12.0.x/http-compliance-modes

Conversation

@lachlan-roberts

Copy link
Copy Markdown
Member

Backport changes for #15502 to jetty-12.0.x.

Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@joakime

joakime commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@lachlan-roberts some test failures here.

  • org.eclipse.jetty.http.HttpParserTest.testChunkEarlyEOF(String)
  • org.eclipse.jetty.http.HttpParserTest.testChunkParse(String)
  • org.eclipse.jetty.http.HttpParserTest.testChunkParseBadTrailer(String)
  • org.eclipse.jetty.http.HttpParserTest.testChunkParseNoTrailer(String)
  • org.eclipse.jetty.http.HttpParserTest.testChunkParseTrailer(String)
  • org.eclipse.jetty.http.HttpParserTest.testChunkParseTrailers(String)
  • org.eclipse.jetty.http.HttpParserTest.testContentLengthThenTransferEncodingChunked(String)
  • org.eclipse.jetty.http.HttpParserTest.testForEmptyChunkedContentContentCompleteTrueDoesNotEmitMessageComplete(String)
  • org.eclipse.jetty.http.HttpParserTest.testForEmptyChunkedContentHeaderCompleteTrueDoesNotEmitContentComplete(String)
  • org.eclipse.jetty.http.HttpParserTest.testMultiParse(String)
  • org.eclipse.jetty.http.HttpParserTest.testMultiParseEarlyEOF(String)
  • org.eclipse.jetty.http.HttpParserTest.testTransferEncodingChunkedThenContentLength(String)

Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@lachlan-roberts lachlan-roberts moved this to 👀 In review in Jetty 12.0.38 FROZEN Jul 29, 2026
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@lachlan-roberts lachlan-roberts changed the title Modernize the non-legacy HttpCompliance modes (12.0) Remove LF_CHUNK_TERMINATION from non-legacy HttpCompliance modes (12.0) Jul 30, 2026
@lachlan-roberts
lachlan-roberts requested review from joakime and olamy and removed request for sbordet July 30, 2026 01:08
@lachlan-roberts
lachlan-roberts merged commit 5bc1f4d into jetty-12.0.x Jul 30, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Jetty 12.0.38 FROZEN Jul 30, 2026
@lachlan-roberts
lachlan-roberts deleted the fix/jetty-12.0.x/http-compliance-modes branch July 30, 2026 04:02
pstreef added a commit to moderne-backpatch-alliance/backpatch-jetty.project that referenced this pull request Oct 22, 2026
GHSA-xc35-c22g-239h. HttpParser.next() returns a bare LF as a line end, and
the chunk states took it as the end of a chunk-size line, of the chunk data
and of the last chunk: a front end that only honours CRLF frames the body
differently (request smuggling). In the chunk states (size line, extensions,
after chunk data, last line) a bare LF is now a 400 "Bad EOL". Header lines
still accept a bare LF, as RFC 9112 2.2 allows for the start line and fields.

Original work modelled on upstream's 12.0.38 fix (PR jetty#15503, merge
5bc1f4d):
- 389ffcb (Lachlan Roberts): Modernize the
  non-legacy HttpCompliance modes
- 315d269 and
  de4c1e5 (Lachlan Roberts): fix failing tests
from https://github.com/eclipse/jetty.project. Upstream makes a bare LF in
chunk framing a violation (LF_CHUNK_TERMINATION) of its default modes and
allows it only in RFC2616_LEGACY and RFC7230_LEGACY. 9.2 has no
HttpCompliance, so upstream's default applies and no switch is added. A
blank bare-LF line between chunks, which upstream does not flag, is
rejected here too.

Tests: HttpParserTest#testChunkLinesNeedCRLF and
#testChunkCRLFSplitAcrossBuffers are ours. As in upstream's de4c1e5,
PartialRFC2616Test's chunked bodies now use CRLF (its header lines keep LF).

Upstream-Commit: 389ffcb
Upstream-Commit: 315d269
Upstream-Commit: de4c1e5
Upstream-Commit: 5bc1f4d
Co-authored-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Co-authored-by: Lachlan <lachlan@webtide.com>
pstreef added a commit to moderne-backpatch-alliance/backpatch-jetty.project that referenced this pull request Oct 29, 2026
…EGACY allows a bare LF

GHSA-xc35-c22g-239h. HttpParser.next() returns a bare LF as a line end, and
every chunk state took it: the chunk-size line, its extensions (00001 kept
LF there on purpose), the line after chunk data, the last chunk and the
trailer. A front end that only honours CRLF frames the body differently
(request smuggling); the advisory's vector is 3D;!<LF>.

As upstream's 12.0 fix, a bare LF in chunk framing is now a violation of a
new HttpComplianceSection, LF_CHUNK_TERMINATION. Like
TRANSFER_ENCODING_WITH_CONTENT_LENGTH it is a requirement: RFC2616,
RFC7230, RFC7230_LEGACY, RFC7230_NO_AMBIGUOUS_URIS and the custom default
include it. RFC2616_LEGACY excludes it, so it still accepts a bare LF and
reports the violation. LEGACY has none.

Unlike upstream, RFC7230_LEGACY keeps the requirement (Peter, 2026-10-29,
changing his 2026-10-26 answer for that mode only): 9.4's etc/jetty-http.xml
defaults the plain-HTTP connector of a jetty-home install to RFC7230_LEGACY,
while Jetty 12's distribution defaults to RFC7230, so upstream's mode list
would have left a default 9.4 install open. A deployment that needs bare-LF
chunk framing sets jetty.http.compliance=RFC2616_LEGACY or a custom mode. A rejected line ends the
message as an early EOF, the parser's path for every bad byte after the
headers, as in 00006. Header lines still accept a bare LF.

Adapted from upstream's 12.0.38 fix (PR jetty#15503, merge
5bc1f4d):
- 389ffcb (Lachlan Roberts): Modernize the
  non-legacy HttpCompliance modes
- 315d269 and
  de4c1e5 (Lachlan Roberts): fix failing tests
from https://github.com/eclipse/jetty.project. Upstream marks a bare LF with
new EOL tokens from next(); 9.4 keeps HttpTokens unchanged and checks the
byte before next() in a private nextChunkToken, the jetty-9.2 port's shape.
A blank bare-LF line between chunks, which upstream does not flag, is a
violation here too, as in the 9.2 port.

Tests: HttpParserTest#testChunkLinesNeedCRLF and
#testChunkCRLFSplitAcrossBuffers are the 9.2 port's (a333152), with a
bare-LF trailer line added.
#testLFChunkTerminationAllowedOnlyByRFC2616LegacyCompliance is ours:
RFC7230, RFC7230_LEGACY, RFC7230_NO_AMBIGUOUS_URIS and RFC2616 reject the
advisory's vector; RFC2616_LEGACY accepts it and every bare-LF case and
reports LF_CHUNK_TERMINATION. The bare-LF case of 00006's
#testChunkDataWithLineTerminator moves to those tests. As in upstream's
de4c1e5, the chunked bodies of PartialRFC2616Test and RFC2616BaseTest now
use CRLF (their header lines keep LF).

Upstream-Commit: 389ffcb
Upstream-Commit: 315d269
Upstream-Commit: de4c1e5
Upstream-Commit: 5bc1f4d
Co-authored-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Co-authored-by: Lachlan <lachlan@webtide.com>
pstreef added a commit to finos-osera-forks/patch-jetty.project that referenced this pull request Oct 29, 2026
…EGACY allows a bare LF

GHSA-xc35-c22g-239h. HttpParser.next() returns a bare LF as a line end, and
every chunk state took it: the chunk-size line, its extensions (00001 kept
LF there on purpose), the line after chunk data, the last chunk and the
trailer. A front end that only honours CRLF frames the body differently
(request smuggling); the advisory's vector is 3D;!<LF>.

As upstream's 12.0 fix, a bare LF in chunk framing is now a violation of a
new HttpComplianceSection, LF_CHUNK_TERMINATION. Like
TRANSFER_ENCODING_WITH_CONTENT_LENGTH it is a requirement: RFC2616,
RFC7230, RFC7230_LEGACY, RFC7230_NO_AMBIGUOUS_URIS and the custom default
include it. RFC2616_LEGACY excludes it, so it still accepts a bare LF and
reports the violation. LEGACY has none.

Unlike upstream, RFC7230_LEGACY keeps the requirement (Peter, 2026-10-29,
changing his 2026-10-26 answer for that mode only): 9.4's etc/jetty-http.xml
defaults the plain-HTTP connector of a jetty-home install to RFC7230_LEGACY,
while Jetty 12's distribution defaults to RFC7230, so upstream's mode list
would have left a default 9.4 install open. A deployment that needs bare-LF
chunk framing sets jetty.http.compliance=RFC2616_LEGACY or a custom mode. A rejected line ends the
message as an early EOF, the parser's path for every bad byte after the
headers, as in 00006. Header lines still accept a bare LF.

Adapted from upstream's 12.0.38 fix (PR jetty#15503, merge
5bc1f4d):
- 389ffcb (Lachlan Roberts): Modernize the
  non-legacy HttpCompliance modes
- 315d269 and
  de4c1e5 (Lachlan Roberts): fix failing tests
from https://github.com/eclipse/jetty.project. Upstream marks a bare LF with
new EOL tokens from next(); 9.4 keeps HttpTokens unchanged and checks the
byte before next() in a private nextChunkToken, the jetty-9.2 port's shape.
A blank bare-LF line between chunks, which upstream does not flag, is a
violation here too, as in the 9.2 port.

Tests: HttpParserTest#testChunkLinesNeedCRLF and
#testChunkCRLFSplitAcrossBuffers are the 9.2 port's (a333152), with a
bare-LF trailer line added.
#testLFChunkTerminationAllowedOnlyByRFC2616LegacyCompliance is ours:
RFC7230, RFC7230_LEGACY, RFC7230_NO_AMBIGUOUS_URIS and RFC2616 reject the
advisory's vector; RFC2616_LEGACY accepts it and every bare-LF case and
reports LF_CHUNK_TERMINATION. The bare-LF case of 00006's
#testChunkDataWithLineTerminator moves to those tests. As in upstream's
de4c1e5, the chunked bodies of PartialRFC2616Test and RFC2616BaseTest now
use CRLF (their header lines keep LF).

Upstream-Commit: 389ffcb
Upstream-Commit: 315d269
Upstream-Commit: de4c1e5
Upstream-Commit: 5bc1f4d
Co-authored-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Co-authored-by: Lachlan <lachlan@webtide.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants