Make the behavior of request_parse_body() and ini settings congruent in option max_input_vars#22223
Open
OracleNep wants to merge 1 commit into
Open
Conversation
Contributor
|
Interesting, but
|
bcad8b6 to
bac9666
Compare
Author
|
Thanks for the review. Updated the PR accordingly:
I moved the PR back to draft while the updated CI is running. |
Contributor
|
Thank you. This looks fine to me and I will have a closer look hours later before I request review from other people :) |
LamentXU123
approved these changes
Jun 4, 2026
Contributor
LamentXU123
left a comment
There was a problem hiding this comment.
Overall correct to me. Let's hear from @iluuu1994 for further opinions :)
Member
|
Hi. Thanks for the PR. Two notes:
|
Contributor
|
Thanks for introducing this concern. After a closer look of the ini behavior, I'd suggest that:
|
44be3c5 to
861aaf7
Compare
Contributor
|
Now I believe this PR makes the behavior of request_parse_body and ini congruent. |
request_parse_body() and ini settings congruent in option max_input_vars
d19f647 to
0394354
Compare
0394354 to
0743a1e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
request_parse_body()currently accepts out-of-range values for limit-related options.This can weaken or bypass request body limits. In particular, for
application/x-www-form-urlencodedbodies, negativemax_input_varsvalues are read into an unsigneduint64_t, so passingmax_input_vars => -1effectively turns the limit into a very large value.post_max_size => -1andpost_max_size => 0also disable the size check, because the check only runs when the configured value is greater than zero.upload_max_filesizefollows the same positive-size-limit pattern.This patch rejects invalid option ranges for:
max_multipart_body_partsis left unchanged because negative values currently have a special meaning there: derive the multipart body part limit frommax_input_vars + max_file_uploads.This is a hardening / validation fix, not a security report. The options are supplied by application code, but accepting invalid ranges makes it easy to accidentally disable request body limits.
Local verification
Using php-src master
be41c36b68f, tested with the built-in web server:accepted all urlencoded fields, while:
triggered the expected max-input-vars warning path.
Also verified:
accepted a body that was rejected when
post_max_size => 1.Tests