-
Notifications
You must be signed in to change notification settings - Fork 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
Request mvc matcher does not match for actuator endpoint jolokia #13741
Comments
Any news? |
Sorry for the delay, @npriebe. The answer is likely because What is the underlying servlet configuration for this application? I'm specifically curious about what servlets are registered and to what URL patterns. If you aren't sure how to obtain this, you could also post a minimal sample application on GitHub that uses your version of Boot, Spring Security, Actuator, and Jolokia, and I'd be happy to help. |
Hi @jzheaux , I have set up an example project with which you can reproduce the problem: https://github.com/npriebe/spring-security-jolokia-example In the documentation, the Jolokia endpoint is listed under web endpoints, so I actually expect it to behave the same way as the Prometheus endpoint. Which is secured with mvc, for example. https://docs.spring.io/spring-boot/docs/2.2.0.RELEASE/reference/html/production-ready-features.html#production-ready-endpoints |
Thanks for the sample. Actuator endpoints are a mixture of Spring MVC and other endpoints. Given that, Spring Boot provides a request matcher that you can use like so: http
.requestMatcher(EndpointRequest.toAnyEndpoint())
.authorize... to alleviate the need for you to figure out which are which. As a side note, the need for your application to recognize this distinction is reduced in Spring Security 6.2. In that version, you can simply specify |
Thank you for the explanation. My Spring application is currently still running with Spring Security Version 5.6.1, which is why the option to secure the endpoints via the |
Describe the bug
I am trying to secure my actuator endpoints. For this purpose, I have a Multiple-Config where I specify the paths via an MVC RequestMatcher, which endpoints are to be used for which config.
The goal is that all actuator endpoints are secured and the remaining endpoints of my application are open.
My security config:
If I now specify my actuator endpoints via a MvcMatcher, all actuator endpoints are secured except for the endpoint "/actuator/jolokia".
Example:
"/actuator/prometheus" is secured:
"/actuator/jolokia" is open:
But if I now use AntMatcher as a matcher, the endpoint "/actuator/jolokia" is also secured.
Why does the MvcMatcher not work for the specific endpoint "/actuator/jolokia"? Is this a bug or is there a precise reason why the endpoint "/actuator/jolokia" only works with an AntMatcher?
To Reproduce
Use the Config
http.requestMatchers(matcher -> matcher.mvcMatchers("/actuator/**")).authorizeRequests().anyRequest().authenticated();
in your Security Config and call the endpoint "actuator/jolokia" with the expectation that it is secured.Expected behavior
That the mvcMatcher has secured the Actuator endpoint Jolokia.
The text was updated successfully, but these errors were encountered: