You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
After upgrading Spring Boot from 2.7.11 (Spring Security 5.7.8) to 3.1.2 (Spring Security 6.1.2) uploading multipart file has stopped working. We are using Apache Camel for processing uploaded file.
To Reproduce
We have created repo with example (https://github.com/McNullty/camel-upload-with-security), on branch master we have used latest versions of Spring Boot / Spring Security and Camel, on branch old-spring boot there is version with older versions of Spring and Camel.
We have also tested latest Camel without Spring Security and it is working as expected.
Expected behavior
Example can be tested by sending any file with curl, eg.:
I have also found that if I put log statement that "tickles" request.getInputStream() in filter before RequestCacheAwareFilter application also works as expected.
Eg.
public class DebugFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
log.info("Input Stream: {}", request.getInputStream());
chain.doFilter(request, response);
}
}
Prior to this commit, the ServletRequest#getParameter method was used in order to verify if the matchingRequestParameterName was present in the request. That method has some side effects like interfering in the execution of the ServletRequest#getInputStream and ServletRequest#getReader method when the request is an HTTP POST (if those methods are invoked after getParameter, or vice-versa, the content won't be available). This commit makes that we only use the query string to check for the parameter, avoiding draining the request's input stream.
Closesspring-projectsgh-13731
Describe the bug
After upgrading Spring Boot from 2.7.11 (Spring Security 5.7.8) to 3.1.2 (Spring Security 6.1.2) uploading multipart file has stopped working. We are using Apache Camel for processing uploaded file.
To Reproduce
We have created repo with example (https://github.com/McNullty/camel-upload-with-security), on branch master we have used latest versions of Spring Boot / Spring Security and Camel, on branch old-spring boot there is version with older versions of Spring and Camel.
We have also tested latest Camel without Spring Security and it is working as expected.
Expected behavior
Example can be tested by sending any file with curl, eg.:
Expected behavior is that In Camel exchange body there is file with size different than 0.
Sample
A link to a GitHub repository with a minimal, reproducible sample.
The text was updated successfully, but these errors were encountered: