Skip to content

Auto-port 4.1: Reject all control characters and DEL in HTTP response reason phrases - #18381

Merged
chrisvest merged 2 commits into
4.1from
auto-port-pr-18331-to-4.1
Nov 13, 2026
Merged

chrisvest merged 2 commits into
4.1from
auto-port-pr-18331-to-4.1

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #18331 to 4.1
Cherry-picked commit: aa30b7a


Motivation:

HttpResponseStatus only rejected CR and LF in the reason phrase. Other control characters (NUL, VT, FF, ...) and DEL were still accepted when parsing a response status line and written verbatim to the wire by HttpResponseEncoder. Lenient downstream parsers may treat these as line separators (response splitting / desync) and C-string based parsers may truncate at NUL. This closes the sibling gap of the request line hardening: RFC 9110 defines the reason-phrase as
*( HTAB / SP / VCHAR / obs-text ).

Modification:

Reject every control character except HTAB, and DEL, in the HttpResponseStatus reason phrase. HTAB and SP remain legal.

Result:

A response with control characters in its reason phrase is now rejected by the decoder instead of being accepted and re-encoded verbatim.

…#18331)

Motivation:

HttpResponseStatus only rejected CR and LF in the reason phrase. Other
control characters (NUL, VT, FF, ...) and DEL were still accepted when
parsing a response status line and written verbatim to the wire by
HttpResponseEncoder. Lenient downstream parsers may treat these as line
separators (response splitting / desync) and C-string based parsers may
truncate at NUL. This closes the sibling gap of the request line
hardening: RFC 9110 defines the reason-phrase as
*( HTAB / SP / VCHAR / obs-text ).

Modification:

Reject every control character except HTAB, and DEL, in the
HttpResponseStatus reason phrase. HTAB and SP remain legal.

Result:

A response with control characters in its reason phrase is now rejected
by the decoder instead of being accepted and re-encoded verbatim.

(cherry picked from commit aa30b7a)
Motivation:

The auto-port of #18331 added tests using lambda expressions, but the 4.1
branch compiles tests with -source 1.6, so verify-pr failed with
'lambda expressions are not supported in -source 1.6'.

Modification:

Replace the lambdas with anonymous Executable classes and drop the
assertThatThrownBy usage in favour of assertThrows plus assertThat.

Result:

The tests compile on the 4.1 Java 6 baseline.
@chrisvest chrisvest added this to the 4.1.141.Final milestone Nov 13, 2026
@chrisvest
chrisvest enabled auto-merge (squash) November 13, 2026 17:25
@testlens-app

testlens-app Bot commented Nov 13, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 189cefe
▶️ Tests: 89638 executed
⚪️ Checks: 18/18 completed


Learn more about TestLens at testlens.app/docs.

@chrisvest
chrisvest merged commit 2df8707 into 4.1 Nov 13, 2026
19 checks passed
@chrisvest
chrisvest deleted the auto-port-pr-18331-to-4.1 branch November 13, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants