Add Spring MVC-generated path suffixes to endpoint paths
Spring Security doesn't know that Spring MVC maps /foo, /foo.json and /foo/ all to the same handler. This change explicitly adds suffixes to the actuator endpoint matchers so they are properly protected.
This commit is contained in:
@@ -221,7 +221,13 @@ public class ManagementSecurityAutoConfiguration {
|
||||
List<String> paths = new ArrayList<String>(endpoints.size());
|
||||
for (MvcEndpoint endpoint : endpoints) {
|
||||
if (endpoint.isSensitive() == secure) {
|
||||
paths.add(endpointHandlerMapping.getPrefix() + endpoint.getPath());
|
||||
String path = endpointHandlerMapping.getPrefix() + endpoint.getPath();
|
||||
paths.add(path);
|
||||
if (secure) {
|
||||
// Add Spring MVC-generated additional paths
|
||||
paths.add(path + "/");
|
||||
paths.add(path + ".*");
|
||||
}
|
||||
}
|
||||
}
|
||||
return paths.toArray(new String[paths.size()]);
|
||||
|
||||
Reference in New Issue
Block a user