diff options
author | John Hawthorn <john@hawthorn.email> | 2022-12-08 15:54:28 -0800 |
---|---|---|
committer | Aaron Patterson <tenderlove@ruby-lang.org> | 2023-03-02 15:00:33 -0800 |
commit | 8e8869d625e73e16b576b6d31b50208e9ec8002f (patch) | |
tree | aeb318c8a22250da36b40a512efab9d17ee8738b /README.md | |
parent | 0b26518acc4c946ca96dfe3d9e68a05ca84439f7 (diff) | |
download | rack-8e8869d625e73e16b576b6d31b50208e9ec8002f.tar.gz |
Limit all multipart parts, not just files
Previously we would limit the number of multipart parts which were
files, but not other parts. In some cases this could cause parsing of
maliciously crafted inputs to take longer than expected.
[CVE-2023-27530]
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -186,19 +186,35 @@ but this query string would not be allowed: Limiting the depth prevents a possible stack overflow when parsing parameters. -### `multipart_part_limit` +### `multipart_file_limit` ```ruby -Rack::Utils.multipart_part_limit = 128 # default +Rack::Utils.multipart_file_limit = 128 # default ``` -The maximum number of parts a request can contain. Accepting too many parts can -lead to the server running out of file handles. +The maximum number of parts with a filename a request can contain. Accepting +too many parts can lead to the server running out of file handles. The default is 128, which means that a single request can't upload more than 128 files at once. Set to 0 for no limit. -Can also be set via the `RACK_MULTIPART_PART_LIMIT` environment variable. +Can also be set via the `RACK_MULTIPART_FILE_LIMIT` environment variable. + +(This is also aliased as `multipart_part_limit` and `RACK_MULTIPART_PART_LIMIT` for compatibility) + + +### `multipart_total_part_limit` + +The maximum total number of parts a request can contain of any type, including +both file and non-file form fields. + +The default is 4096, which means that a single request can't contain more than +4096 parts. + +Set to 0 for no limit. + +Can also be set via the `RACK_MULTIPART_TOTAL_PART_LIMIT` environment variable. + ## Changelog |