Skip to content

clearer docs about about where request limits apply - #3251

Merged
davidism merged 1 commit into
stablefrom
request-limits
Aug 21, 2026
Merged

davidism merged 1 commit into
stablefrom
request-limits

Conversation

@davidism

Copy link
Copy Markdown
Member

Add more docs to address the constant stream of invalid security reports about the form parser and max content length.

  • The stream must be limited by using FormDataParser.parse_from_environ or get_input_stream.
  • max_form_memory_size and max_form_parts are additional checks, they do not replace a limited stream and max_content_length.
  • Update docs, Request attr docstrings, and FormDataParser docstrings.
  • Add a comment to _parse_urlencoded explaining why it doesn't use max_form_memory_size or max_form_parts.

_parse_urlencoded actually did enforce content_length <= max_form_memory_size, which was where a lot of the invalid reports were coming from since they only looked at that and nothing else. That check seems to have been there forever, but it seems to be incorrect. max_form_memory_size is for multipart/form-data (and is already dubiously useful for text parts, since they will still all take up memory in the end, which should be limited with max_content_length). The check here was applied to the entire body as if it was max_content_length. We also decided that enforcing max_form_parts there didn't make sense. I removed the check.

@davidism davidism added this to the 3.1.9 milestone Aug 21, 2026
remove max_form_memory_size check for aplication/x-www-form-urlencoded
@davidism
davidism merged commit eca1f98 into stable Aug 21, 2026
14 checks passed
@davidism
davidism deleted the request-limits branch August 21, 2026 04:52
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant