Skip to content

[release/11.0] Fix: hardening http2 to refuse newline chars on trailers and dynamic HPACK table - #69247

Merged
SamMonoRT merged 2 commits into
release/11.0from
brecon/11valid
Sep 14, 2026
Merged

SamMonoRT merged 2 commits into
release/11.0from
brecon/11valid

Conversation

@BrennanConroy

Copy link
Copy Markdown
Member

Backport of #68743 to release/11.0

Fix: hardening http2 to refuse newline chars on trailers and dynamic HPACK table

Description

Kestrel previously skipped validation for CR/LF in two places: request trailers and HPACK dynamic table retrieval. Based on RFC 7540 section 10.3, these values must be treated as malformed. The validation for newline characters has now been enabled along with tests to ensure compliance.

Customer Impact

Invalid headers could show up in logs or application logic processing.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Good test coverage, easy to reason about change

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

amf-fs and others added 2 commits September 11, 2026 11:14
…HPACK table (#68743)

* Hardening trailers to refuse new line chars

* Hardening HPACK dynamic header to refuse new line chars

* Http3 request trailers with newline chars test

* Added test to exercise newline chars on indexed headers
Copilot AI lite review requested due to automatic review settings September 11, 2026 18:21
@BrennanConroy BrennanConroy added Servicing-consider Shiproom approval is required for the issue feature-kestrel area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions labels Sep 11, 2026
@BrennanConroy BrennanConroy changed the title Fix: hardening http2 to refuse newline chars on trailers and dynamic HPACK table [release/11.0] Fix: hardening http2 to refuse newline chars on trailers and dynamic HPACK table Sep 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Update the HTTP/3 trailer test to use _noopApplication so malformed trailers do not produce unrelated application errors.

Review tier: Lite
Findings: None

What changed in this PR

This backport hardens Kestrel HTTP/2 and HTTP/3 handling by rejecting CR/LF characters in request trailers and dynamic HPACK values.

Changes:

  • Enables newline validation for trailers and dynamic HPACK headers.
  • Adds HTTP/2 and HTTP/3 regression coverage for malformed values.
  • Refactors HTTP/2 trailer test data setup.
File Summary
src/​Servers/​Kestrel/​test/​InMemory.FunctionalTests/​Http3/​Http3StreamTests.cs Tests HTTP/3 trailer newline rejection; should use _noopApplication to avoid unrelated application errors.
src/​Servers/​Kestrel/​test/​InMemory.FunctionalTests/​Http2/​Http2StreamTests.cs Tests dynamic HPACK newline rejection.
src/​Servers/​Kestrel/​test/​InMemory.FunctionalTests/​Http2/​Http2ConnectionTests.cs Adds malformed HTTP/2 trailer cases.
src/​Servers/​Kestrel/​Core/​src/​Internal/​Http2/​Http2Connection.cs Validates dynamic HPACK header values.
src/​Servers/​Kestrel/​Core/​src/​Internal/​Http/​HttpProtocol.cs Validates request trailer values.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@BrennanConroy BrennanConroy added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Sep 11, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @BrennanConroy. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed.

@SamMonoRT
SamMonoRT merged commit 7eaeec1 into release/11.0 Sep 14, 2026
47 of 50 checks passed
@SamMonoRT
SamMonoRT deleted the brecon/11valid branch September 14, 2026 18:04
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc2 milestone Sep 14, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — a34f442f Deployed Sep 11, 2026 by BrennanConroy via conclusion #1321
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-kestrel Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants