Repository navigation
fix(inputs.http_listener_v2): Limit the body size for every content encoding - #19915
Merged
skartikey merged 1 commit intoOct 29, 2026
Merged
Conversation
skartikey
force-pushed
the
fix/http-listener-v2-bound-body
branch
from
October 16, 2026 15:05
771b893 to
418b0cd
Compare
srebhan
reviewed
Oct 20, 2026
srebhan
left a comment
Member
There was a problem hiding this comment.
Thanks @skartikey! Just one comment regarding the switch removal...
skartikey
force-pushed
the
fix/http-listener-v2-bound-body
branch
from
October 29, 2026 14:55
418b0cd to
a047c36
Compare
Contributor
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
max_body_sizelimit was only enforced through the content-length header and, for gzip bodies, through a reader limit on the decompressed stream. A client that sends the body chunked has no content length, so the plain and the snappy path read the whole body into memory regardless of the configured limit. The snappy path has a second problem: the block format announces the decoded length in its header andsnappy.Decodeallocates that length up front, so a five byte body can demand up to 4 GiB before the input is found to be corrupt.The body is now wrapped in a
http.MaxBytesReaderfor every encoding, asinputs.influxdb_listeneralready does, with the existing second limit on the decompressed gzip stream kept. The snappy path checks the announced decoded length against the limit before decoding. A read that hits the limit answers 413 as the content-length check does, any other read error stays a 400. The new test sends a chunked body above the limit plain, gzipped and snappy-compressed, plus a snappy header announcing an oversized length, and expects 413 with nothing accepted for each.Checklist
Related issues
resolves #19629