Ensure that management endpoints with nested paths are secured
Previously each endpoint was secured for path, path/, and path.*. This meant that a request to path/foo was not secured. This commit secures path/** to ensure that requests to a nested endpoint path are also secured. Fixes gh-2476
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -69,6 +69,7 @@ import org.springframework.util.StringUtils;
|
||||
* used as a security hint by the filter created here.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass({ EnableWebSecurity.class })
|
||||
@@ -243,8 +244,9 @@ public class ManagementSecurityAutoConfiguration {
|
||||
String path = endpointHandlerMapping.getPrefix() + endpoint.getPath();
|
||||
paths.add(path);
|
||||
if (secure) {
|
||||
// Ensure the nested paths are secured
|
||||
paths.add(path + "/**");
|
||||
// Add Spring MVC-generated additional paths
|
||||
paths.add(path + "/");
|
||||
paths.add(path + ".*");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,6 +42,7 @@ import org.springframework.web.util.UrlPathHelper;
|
||||
* {@link MvcEndpoint} to expose Jolokia.
|
||||
*
|
||||
* @author Christian Dupuis
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "endpoints.jolokia", ignoreUnknownFields = false)
|
||||
public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean,
|
||||
@@ -51,7 +52,7 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean,
|
||||
@Pattern(regexp = "/[^/]*", message = "Path must start with /")
|
||||
private String path;
|
||||
|
||||
private boolean sensitive;
|
||||
private boolean sensitive = true;
|
||||
|
||||
private boolean enabled = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user