-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
SecRequestBodyInMemoryLimit not used in V3 #1516
Comments
The request size is taken into consideration into this block here: As you can see the values are being handled. |
Hi @zimmerle. I think we are talking about two different configuration directives. In seclang-scanner.ll
In seclang-parser.yy
Searching all the files from the release for m_requestBodyInMemoryLimit
m_requestBodyLimit is set from CONFIG_DIR_REQ_BODY_LIMIT
which in the scanner is SecRequestBodyLimit not SecRequestBodyInMemoryLimit
From the documentation
and
I had assumed that this would have put an upper limit to the size of the buffer created in Transaction::requestBodyFromFile() that is used to read the request from file. Is there any reason that the Transaction::requestBodyFromFile() needs to read all of the request file into memory at once? Could it read portions of the file and call Transaction::appendRequestBody() in a loop? |
Hi @zimmerle have you had a chance to read my reply? |
Sorry for the delay. Indeed, SecRequestBodyInMemoryLimit was not being used. I've changed the parser to state that this configuration is no longer available. Here goes the reason: LibModSecurity is able to deal with request body in a file or in a buffer (chunked or not). Nginx has this property client_body_buffer_size which controls whenever a request should be saved to a file or used as a buffer. If it is a file, ModSecurity will use the file to perform the inspection. If not, the buffer will be used. |
Thanks very much @zimmerle! |
Looking at the code for Modsecurity V3, the configuration directive
SecRequestBodyInMemoryLimit is not used. The parser accepts the value of SecRequestBodyInMemoryLimit and uses it to set the value of driver.m_requestBodyInMemoryLimit. However, driver.m_requestBodyInMemoryLimit is not used in any other part of the code.
The text was updated successfully, but these errors were encountered: