dotnet / dotnet/aspnetcore

Tighten the HTTP/2 and HTTP/3 `:path` guard to the printable-ASCII bound

Open
#68,270 1 comment 0 reactions 1 assignee Claimed by @cincuranet View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

So non-ASCII (including the U+0080 - U+00FF window) is rejected before any byte truncation - matching HTTP/1.1's `GetAsciiString` behavior. The #67109 was a good direction, but needs to be tightened even more.

Something like (`Http2Stream.cs:444` and `Http3Stream.cs:1222`):
```csharp
var ch = pathSegment[i];
// URI path must be printable ASCII (matches HTTP/1.1 GetAsciiString + RFC 3986/3987).
if (ch < 0x20 || ch > 0x7E)
{
ResetAndAbort(...);
return false;
}
pathBuffer[i] = (byte)ch;
```

Add regression tests covering the U+0080 - U+00FF window (e.g., U+00A9, U+00C3, U+00E9) plus a percent-escape, asserting PROTOCOL_ERROR, so the coverage gap left by the U+0161-only tests is closed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.