snowflake/http: Limit Decompressed Request to 10MB#33648
Merged
Conversation
rosstimothy
approved these changes
Oct 18, 2023
fheinecke
approved these changes
Oct 20, 2023
AntonAM
approved these changes
Oct 20, 2023
zmb3
reviewed
Oct 20, 2023
| defer bodyGZ.Close() | ||
|
|
||
| body, err = io.ReadAll(bodyGZ) | ||
| body, err = utils.ReadAtMost(bodyGZ, teleport.MaxHTTPRequestSize) |
Collaborator
There was a problem hiding this comment.
We've already read at most 10MB of (potentially compressed) data on line 84, and now we're requiring that the uncompressed data is also below the same threshold. Is this what we want?
You can probably just remove this particular change. Our Edit: GitHub navigated me to the wrong gzip.NewReader already enforces a 10MB limit, so this code is functionally equivalent to the prior version.NewReader impl. I take this back :-)
Contributor
Author
There was a problem hiding this comment.
That is the intention here. The issue is that 10MB of compressed data can decompress into gigabytes of data which could easily impact the service.
This was referenced Oct 20, 2023
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.
This PR limits the decompressed size for Snowflake requests to 10MB. This limit matches what we are willing to accept in an uncompressed request as well.
This was a missed case as part of the improvements from https://github.com/gravitational/teleport-private/issues/660