-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
max_content_length is not enforced in all cases #690
Comments
Note that this is a regression in 0.9. In 0.8 the .data property unconditionally attempted form parsing, which triggered the length checks, but in 0.9 the form parsing is skipped if the content type is not suitable. |
Also, I guess it's a security issue since any application which is using .get_data() and is relying on .max_content_length to enforce length restrictions is now subject to memory exhaustion DoS with Werkzeug 0.9... |
I suppose this really is a security and design issue. Since form parsing is now optional, length checks have to occur outside of FormDataParser. |
@mitsuhiko said in IRC that this value was never really enforced. We also talked about the fact that Werkzeug's request object isn't actually the right place for such functionality. For this reason, I'd rather move this functionality into a middleware, but this is going to take some time and isn't appropriate for a bugfix release. |
Production WSGI servers handle terminating input, and can indicate it in cases where content length isn't set by setting |
Fixed by #2620 |
The wording in the docs about the
max_content_length
property indicates that it applies for all usages of the request, including when accessing the raw request data.However in Werkzeug 0.9+ it actually only applies when form data is parsed (and that's the only case covered by tests). The length is not enforced when .get_data() is called.
Failing test case:
The text was updated successfully, but these errors were encountered: