-
Notifications
You must be signed in to change notification settings - Fork 40.9k
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
/error page not accessible with latest Spring Security in certain situations #30072
Comments
I noticed that when you explicitly allow access by adding |
Hi @jkuipers , Hope this helps. |
Thanks for the sample, @jkuipers. I believe that the change in behavior is due to the changes made for spring-projects/spring-security#10680. They appear to have exposed a problem with the matchers in your security configuration. I don't fully understand what's going on with the matchers in Spring Security, but your configuration is resulting in Please open a Spring Security issue and comment here with a link to it. |
Thanks for looking into this, Andy! (esp. during the weekend) |
Issue will be fixed in Spring Security 5.6.3. |
This issue is back when you use Spring Boot 3 with Spring Security 6. This seems to be caused by a change in Spring Security that now includes I was wondering if the Boot 3 / Security 6 combination is now working as it should be, and I'm expected to explicitly unsecure |
@jkuipers We're trying to align with Spring Security so we believe that things are working as expected. See #33934 for more discussion and specifically this comment: #33934 (comment) |
Thanks for confirming that this works as expected! |
I have the same error with Spring Boot 3 and Spring Security 6. @jkuipers Did you solve the problem? |
Sorry, I don't think we're going to re-open this issue. Boot's behavior is now aligned with Spring Security's which we think is the right thing to do. As Phil mentioned above, please see #33934 for more discussion and specifically this comment: #33934 (comment). As @jkuipers describes above, you can either explicitly unsecure |
After upgrading from Boot 2.6.3 to 2.6.4 we found out that in cases where our service that's secured via Spring Security throws an exception resulting in a 401 or 403 response, the internal forward to Boot's /error page no longer works and an HTTP response is returned that's missing the JSON-marshalled error attributes.
After some trial and error I found out that this only happens with the 5.6.2 version of Spring Security that's provided as a managed dependency by Boot 2.6.4, NOT with the previous 5.6.1 version.
I've attached a simple application with an integration test that demonstrates the issue:
spring-boot-errorpage-security-issue.zip
When you edit the pom.xml to downgrade to Spring Security 5.6.1, the testcase passes as the error page is rendered as expected. As given however, a 403 response without any response body is returned. The same thing happens when you change the exception to result in a 401 rather than a 403: the response will have the expected status code, but no error is rendered.
When you enable debug logging it becomes clear that the DispatcherServlet is never called to render the /error page; somehow Spring Security is preventing it from happening with 5.6.2.
Since I haven't investigated the root cause yet I'm not 100% sure if this is a Spring Boot issue or a Spring Security issue, so I'm reporting this here for now.
The text was updated successfully, but these errors were encountered: