Skip to content

Enforce receive message size limits during decompression - #2780

Merged
JamesNK merged 4 commits into
grpc:masterfrom
JamesNK:fix-compressed-receive-message-size
Oct 28, 2026
Merged

JamesNK merged 4 commits into
grpc:masterfrom
JamesNK:fix-compressed-receive-message-size

Conversation

@JamesNK

@JamesNK JamesNK commented Oct 28, 2026

Copy link
Copy Markdown
Member

Stack

Depends on #2779. This branch is based on that PR's head commit (e442512cd33e719b14565ccc0bbf91e159a9688b).

The PR targets master, so the dependency-update commit is included until the parent PR merges. Merge #2779 first; the intended follow-up change is commit 7b9f27de.

Summary

  • Enforce MaxReceiveMessageSize on both compressed and decompressed messages for server requests and client responses.
  • Share bounded decompression between the client and server, stopping after at most one byte beyond the limit and returning ResourceExhausted before deserialization.
  • Preserve the existing compressed-frame size check, exact-limit acceptance, and unlimited behavior when the configured limit is null.
  • Document compressed-message limit semantics and add gzip/deflate regression coverage for unary and streaming receive paths, early termination, and decompression-stream disposal.

Validation

  • .NET 10 client message-size and compression tests: 31 passed.
  • .NET 10 server pipe tests: 85 passed.
  • .NET 10 server message-size and compression functional tests: 32 passed.
  • Client build across all six target frameworks: zero warnings and errors.
  • Supplied reproduction: a 260,934-byte compressed request expanding to 256 MiB now returns ResourceExhausted; the service receives no message, with approximately 9 MiB allocated during the call.
  • git diff --check passed.

Bound decompressed request and response messages by MaxReceiveMessageSize before deserialization. Share bounded copying between client and server and cover compressed unary and streaming messages with regression tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JamesNK
JamesNK force-pushed the fix-compressed-receive-message-size branch from 7b9f27d to ef84a83 Compare October 28, 2026 07:46
JamesNK and others added 3 commits October 28, 2026 15:49
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@asheshvidyut asheshvidyut left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@JamesNK
JamesNK merged commit c547fa1 into grpc:master Oct 28, 2026
4 of 5 checks passed
This was referenced Oct 29, 2026
This was referenced Nov 4, 2026
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.

2 participants