Skip to content

Validate the query component of the HTTP/2 and HTTP/3 :path pseudo-header - #68320

Merged
DeagleGross merged 4 commits into
dotnet:mainfrom
DeagleGross:deaglegross-solid-guacamole
Aug 14, 2026
Merged

DeagleGross merged 4 commits into
dotnet:mainfrom
DeagleGross:deaglegross-solid-guacamole

Conversation

@DeagleGross DeagleGross self-assigned this Aug 10, 2026
Copilot AI lite review requested due to automatic review settings August 10, 2026 13:51
@DeagleGross DeagleGross added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Aug 10, 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.

Pull request overview

Adds HTTP/2 and HTTP/3 :path pseudo-header validation for the query component to reject raw whitespace and control characters, aligning Kestrel behavior with RFC 9112 request-target constraints and closing the gap described in #67849.

Changes:

  • Introduces a shared helper to detect invalid query characters (CTL, SP, DEL) in request targets.
  • Applies query validation in HTTP/2 and HTTP/3 pseudo-header processing before path decoding/normalization.
  • Adds HTTP/2 and HTTP/3 functional tests covering invalid query characters (reset/abort) and valid query acceptance.
Show a summary per file
File Description
src/Shared/ServerInfrastructure/HttpCharacters.cs Adds invalid-query character search set and IndexOfInvalidQueryChar helper.
src/Servers/Kestrel/Core/src/Internal/Http2/Http2Stream.cs Rejects requests with invalid characters in the query portion of :path.
src/Servers/Kestrel/Core/src/Internal/Http3/Http3Stream.cs Rejects requests with invalid characters in the query portion of :path.
src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs Adds coverage for invalid/valid query characters in HTTP/2 :path.
src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs Adds coverage for invalid/valid query characters in HTTP/3 :path.

Review details

Tip

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

  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

@DeagleGross
DeagleGross requested a review from SamMonoRT as a code owner August 14, 2026 10:02
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kestrel does not validate the query component of HTTP/2/3 :path, allowing raw whitespace/control chars

4 participants