Skip to content

snowflake/http: Limit Decompressed Request to 10MB#33648

Merged
jentfoo merged 2 commits intomasterfrom
jent/snowflake_decompression_limit
Oct 20, 2023
Merged

snowflake/http: Limit Decompressed Request to 10MB#33648
jentfoo merged 2 commits intomasterfrom
jent/snowflake_decompression_limit

Conversation

@jentfoo
Copy link
Copy Markdown
Contributor

@jentfoo jentfoo commented Oct 18, 2023

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

@jentfoo jentfoo self-assigned this Oct 18, 2023
@github-actions github-actions Bot requested review from klizhentas and r0mant October 18, 2023 16:16
@github-actions github-actions Bot added database-access Database access related issues and PRs size/sm labels Oct 18, 2023
defer bodyGZ.Close()

body, err = io.ReadAll(bodyGZ)
body, err = utils.ReadAtMost(bodyGZ, teleport.MaxHTTPRequestSize)
Copy link
Copy Markdown
Collaborator

@zmb3 zmb3 Oct 20, 2023

Choose a reason for hiding this comment

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

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 gzip.NewReader already enforces a 10MB limit, so this code is functionally equivalent to the prior version. Edit: GitHub navigated me to the wrong NewReader impl. I take this back :-)

Copy link
Copy Markdown
Contributor Author

@jentfoo jentfoo Oct 20, 2023

Choose a reason for hiding this comment

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

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.

@jentfoo jentfoo added this pull request to the merge queue Oct 20, 2023
Merged via the queue into master with commit 23907ca Oct 20, 2023
@jentfoo jentfoo deleted the jent/snowflake_decompression_limit branch October 20, 2023 16:19
@public-teleport-github-review-bot
Copy link
Copy Markdown

@jentfoo See the table below for backport results.

Branch Result
branch/v12 Create PR
branch/v13 Create PR
branch/v14 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

database-access Database access related issues and PRs size/sm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants