-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Refine SecRequestBodyNoFilesLimit test cases to cover edge scenarios #3479
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
base: v3/master
Are you sure you want to change the base?
Refine SecRequestBodyNoFilesLimit test cases to cover edge scenarios #3479
Conversation
Extend and adjust existing tests for the SecRequestBodyNoFilesLimit directive in config-body_limits.json to ensure correct handling of edge boundary values.
|
|
Hi @hnakamur, thanks for this PR.
I think Also note, that libmodsecurity3 does not correspond to It counts the added bytes and compares the current length with the given value: ModSecurity/src/transaction.cc Lines 936 to 938 in 09fec93
you're right, but I think we should remove that "extra"
Yes, but as I explained above, I think we should calculate the length without LF: $ echo -n "param1=value1¶m2=value2¶m3=value3" | wc -c
41
Do we need that edge boundary (probably you mean the "extra"
Well, to see the valid value could be helpfully, eg. if we put a valid number into CL header. But again: CL header does not have any effect, it's just there... To show the info about the request length is important, but I think that's only an informative thing. What do you think? |
|
I agree with you about removing an extra Actually I found it gets in the way for testing the edge cases, so I removed an extra For regression tests, the value of Or we can modify regression test to add the calculated Maybe I should close this pull request for now. I’d like to hear your thoughts. |
I think now I understand the idea why was it added... Probably the author wanted to substitute the empty lines in some special cases, but... I'm not sure the result is what they wanted.
Thank you for this - this helped me to understand the original idea. I'm not sure we should add But in most cases, eg. where the payload contains more lines (XML, multipart), there it needs the
Personally I don't like implicit use of values, and as we discussed it does not have any role. I think it's more informative than usable. Therefore I wouldn't support to remove or implicit calculation, let the developer to fill that with a correct value.
What if we add extra |
|
Also, could you rebase your V3 related PR branches with the current v3/master? I fixed some cppcheck issues in #3485. |



what
Extend and adjust existing tests for the
SecRequestBodyNoFilesLimitdirective in config-body_limits.json to ensure correct handling of edge boundary values.Also fix the Content-Length of the requests. Note that an LF is added for each line in the body field. see
ModSecurity/test/regression/regression_test.cc
Line 51 in cebcde3
why
The existing tests do not cover edge boundary lengths. As a result, we cannot verify whether a request body whose length is exactly equal to
SecRequestBodyNoFilesLimitis accepted.references
None.