-
Notifications
You must be signed in to change notification settings - Fork 6k
Duplicate headers when security filter is invoked for async dispatches #4211
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
Comments
@wilkinsona Thanks for reporting this and proving a sample! Spring Security's HeaderWriterFilter (which writes the headers) extends Spring Framework's I've created a very simple example that removes Spring Security from the equation and demonstrates that @rstoyanchev Do you have any insights as to what Spring Security is doing wrong, if this is a bug in @wilkinsona While the root cause appears something a bit more complex, I think we can help mitigate this issue by changing some/most of the security |
I removed the 4.2.2 label because this currently appears to be an issue with |
The problem appears to be that |
A workaround, that requires Servlet 3.0, is to override @Override
protected boolean isAsyncDispatch(HttpServletRequest request) {
return request.getDispatcherType() == DispatcherType.ASYNC;
} |
@wilkinsona Thanks for the additional details. I agree, but think this is likely a change for @rstoyanchev what are your thoughts? Should I create a JIRA? |
The implicit expectation is that in a Spring application the Servlet 3 async support is consumed through Spring's abstraction, i.e. the Regarding the |
IIRC, it was just me writing a quick and dirty app to test some changes in Boot 2.0 to the default filter dispatcher types. Sorry, I wasn't aware that using the Servlet API directly was something of a no-no. |
Okay no worries, it's something we should update anyway. The API that underlies |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
I'm not sure what feedback is required here. @rwinch, did you create a Framework issue? |
Thanks for the nudge @wilkinsona. I'm going to close this in favor of spring-projects/spring-framework#26282 |
Summary
When the security filter is configured with
REQUEST
andASYNC
dispatcher types several headers that are set by Spring Security are duplicated. This is similar to #4199, although it affects more than just the headers related to caching.Actual Behavior
If request handling starts an
AsyncContext
and then callsdispatch
a number of headers will be duplicated:Expected Behavior
No header duplication occurs
Configuration
This can be reproduced using Spring Boot 1.5.1.RELEASE with its default security configuration.
Version
4.2.1.RELEASE.
The problem also occurs with 4.1.4.RELEASE (Spring Boot 1.4.4.RELEASE) although the duplication is not as bad:
Sample
https://github.com/wilkinsona/duplicate-security-headers
The text was updated successfully, but these errors were encountered: