-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clamp maximum preallocation for enveloped messages
For enveloped protocols (gRPC, gRPC-Web, and Connect streaming), this PR clamps the maximum number of bytes that the Connect runtime will pre-allocate based on the size portion of the envelope prefix. This prevents malicious clients from sending a prefix with a very large message size and triggering large allocations in the handler. Note that this is a fallback mechanism explicitly intended to protect servers from fuzzers or malicious payloads - it doesn't protect servers from clients actually sending very large messages. For now, there's no configuration knob to adjust this parameter. Servers can already use `WithReadMaxBytes`, which protects them from both spurious envelopes and genuinely large messages. If this becomes problematic later on, we can always adjust it or expose another option.
- Loading branch information
1 parent
77e6f66
commit 4d1b609
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters