Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content length is checked after downloading full file, allowing for OOM #1

Closed
5225225 opened this issue Jul 27, 2021 · 1 comment
Closed

Comments

@5225225
Copy link

5225225 commented Jul 27, 2021

In upload, you're loading in the full content of the file to memory, and then checking if it is too big. You should be checking the size while downloading, and immediately rejecting a file that is too big.

Steps to reproduce:

curl localhost:8000 -X POST -F file=@/dev/zero and watch as the process uses all your system's memory despite having a max_content_length of 10MB.

@orhun
Copy link
Owner

orhun commented Jul 27, 2021

Thanks for reporting this 👍🏼

@orhun orhun closed this as completed in 60c25e2 Jul 27, 2021
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

No branches or pull requests

2 participants