Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Oct 27, 2022

Backport of #44668 to release/7.0

Send 431 when HTTP/2&3 headers are too large or many

Harden HTTP/2 & 3 to send back 431 errors rather than aborting the connection.

Description

When HTTP/2 hits a header related limit (total size or count) it aborts the connection because HPACK is stateful and failing to process the rest of the headers in a request could corrupt the connection HPACK state. HTTP/3 copied this model. This causes performance and debuggability issues for applications.

To avoid this we'll allow up to 2x of the limits while processing the headers, but then enforce the hard limits later when we can send a 431.

Contributes to #17861 #33622

Customer Impact

Customers have a hard time debugging an application when it kills the connection without reporting an error to the client. It also affects other parallel requests on the same connection.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Small modification to existing behavior.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@ghost ghost added the area-runtime label Oct 27, 2022
@Tratcher Tratcher self-assigned this Oct 27, 2022
@Tratcher Tratcher added this to the 7.0.x milestone Oct 27, 2022
@Tratcher
Copy link
Member

/backport to release/6.0

@github-actions
Copy link
Contributor Author

Started backporting to release/6.0: https://github.com/dotnet/aspnetcore/actions/runs/3339575274

@github-actions
Copy link
Contributor Author

@Tratcher backporting to release/6.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Send 431 when HTTP/2 headers are too large or many #17861
Using index info to reconstruct a base tree...
M	src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs
M	src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs
M	src/Servers/Kestrel/Core/src/Internal/Http2/Http2Stream.cs
M	src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs
M	src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs
M	src/Servers/Kestrel/test/Interop.FunctionalTests/HttpClientHttp2InteropTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Servers/Kestrel/test/Interop.FunctionalTests/HttpClientHttp2InteropTests.cs
CONFLICT (content): Merge conflict in src/Servers/Kestrel/test/Interop.FunctionalTests/HttpClientHttp2InteropTests.cs
Auto-merging src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs
CONFLICT (content): Merge conflict in src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs
Auto-merging src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs
CONFLICT (content): Merge conflict in src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs
Auto-merging src/Servers/Kestrel/Core/src/Internal/Http2/Http2Stream.cs
CONFLICT (content): Merge conflict in src/Servers/Kestrel/Core/src/Internal/Http2/Http2Stream.cs
Auto-merging src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs
CONFLICT (content): Merge conflict in src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs
Auto-merging src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs
CONFLICT (content): Merge conflict in src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Send 431 when HTTP/2 headers are too large or many #17861
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@Tratcher Tratcher added the Servicing-consider Shiproom approval is required for the issue label Oct 27, 2022
@ghost
Copy link

ghost commented Oct 27, 2022

Hi @github-actions[bot]. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge.

To learn more about how to prepare a servicing PR click here.

@adityamandaleeka adityamandaleeka added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Nov 1, 2022
@ghost
Copy link

ghost commented Nov 1, 2022

Hi @github-actions[bot]. 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.

@leecow leecow modified the milestones: 7.0.x, 7.0.1 Nov 1, 2022
@dougbu dougbu merged commit f490fe4 into release/7.0 Nov 4, 2022
@dougbu dougbu deleted the backport/pr-44668-to-release/7.0 branch November 4, 2022 03:11
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
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 Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants