Skip to content

exp/api/remote: limit request body size in SnappyDecodeMiddleware#1996

Open
roidelapluie wants to merge 1 commit intoprometheus:mainfrom
roidelapluie:roidelapluie/remote-write-io-limiter
Open

exp/api/remote: limit request body size in SnappyDecodeMiddleware#1996
roidelapluie wants to merge 1 commit intoprometheus:mainfrom
roidelapluie:roidelapluie/remote-write-io-limiter

Conversation

@roidelapluie
Copy link
Copy Markdown
Member

Add io.LimitReader to cap compressed body reads at maxDecodedSize bytes, preventing unbounded memory allocation before the decoded size check. Remove the unused bufPool/TeeReader that was copying body bytes into a buffer that was never read.

Add io.LimitReader to cap compressed body reads at maxDecodedSize bytes,
preventing unbounded memory allocation before the decoded size check.
Remove the unused bufPool/TeeReader that was copying body bytes into a
buffer that was never read.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
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.

1 participant