Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
d07e351e
Commit
d07e351e
authored
Jan 21, 2021
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish " Change info endpoint to be secure and unexposed by default"
See gh-24715
parent
53c1e798
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
+14
-9
ReactiveManagementWebSecurityAutoConfiguration.java
...ctive/ReactiveManagementWebSecurityAutoConfiguration.java
+3
-4
InfoEndpointAutoConfigurationTests.java
...utoconfigure/info/InfoEndpointAutoConfigurationTests.java
+11
-0
SampleSecureWebFluxApplicationTests.java
...t/secure/webflux/SampleSecureWebFluxApplicationTests.java
+0
-5
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.java
View file @
d07e351e
...
...
@@ -20,7 +20,6 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAu
import
org.springframework.boot.actuate.autoconfigure.health.HealthEndpointAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.info.InfoEndpointAutoConfiguration
;
import
org.springframework.boot.actuate.health.HealthEndpoint
;
import
org.springframework.boot.actuate.info.InfoEndpoint
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.AutoConfigureBefore
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
...
...
@@ -40,8 +39,8 @@ import org.springframework.security.web.server.WebFilterChainProxy;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Reactive Spring Security when
* actuator is on the classpath. Specifically, it permits access to the health
and info
*
endpoints
while securing everything else.
* actuator is on the classpath. Specifically, it permits access to the health
endpoint
* while securing everything else.
*
* @author Madhura Bhave
* @since 2.1.0
...
...
@@ -59,7 +58,7 @@ public class ReactiveManagementWebSecurityAutoConfiguration {
@Bean
public
SecurityWebFilterChain
springSecurityFilterChain
(
ServerHttpSecurity
http
)
throws
Exception
{
http
.
authorizeExchange
((
exchanges
)
->
{
exchanges
.
matchers
(
EndpointRequest
.
to
(
HealthEndpoint
.
class
,
InfoEndpoint
.
class
)).
permitAll
();
exchanges
.
matchers
(
EndpointRequest
.
to
(
HealthEndpoint
.
class
)).
permitAll
();
exchanges
.
anyExchange
().
authenticated
();
});
http
.
httpBasic
(
Customizer
.
withDefaults
());
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointAutoConfigurationTests.java
View file @
d07e351e
...
...
@@ -34,6 +34,17 @@ class InfoEndpointAutoConfigurationTests {
private
final
ApplicationContextRunner
contextRunner
=
new
ApplicationContextRunner
()
.
withConfiguration
(
AutoConfigurations
.
of
(
InfoEndpointAutoConfiguration
.
class
));
@Test
void
runShouldHaveEndpointBean
()
{
this
.
contextRunner
.
withPropertyValues
(
"management.endpoints.web.exposure.include=info"
)
.
run
((
context
)
->
assertThat
(
context
).
hasSingleBean
(
InfoEndpoint
.
class
));
}
@Test
void
runWhenNotExposedShouldNotHaveEndpointBean
()
{
this
.
contextRunner
.
run
((
context
)
->
assertThat
(
context
).
doesNotHaveBean
(
InfoEndpoint
.
class
));
}
@Test
void
runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean
()
{
this
.
contextRunner
.
withPropertyValues
(
"management.endpoint.info.enabled:false"
)
...
...
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/SampleSecureWebFluxApplicationTests.java
View file @
d07e351e
...
...
@@ -50,11 +50,6 @@ class SampleSecureWebFluxApplicationTests {
.
isOk
();
}
@Test
void
infoInsecureByDefault
()
{
this
.
webClient
.
get
().
uri
(
"/actuator/info"
).
accept
(
MediaType
.
APPLICATION_JSON
).
exchange
().
expectStatus
().
isOk
();
}
@Test
void
otherActuatorsSecureByDefault
()
{
this
.
webClient
.
get
().
uri
(
"/actuator/env"
).
accept
(
MediaType
.
APPLICATION_JSON
).
exchange
().
expectStatus
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment