-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
Describe the bug
When using Spring Security with WebFlux, /actuator can be unsecured but all other actuator endpoints cannot. The sample code below shows /actuator
and /actuator/info
being configured with .permitAll()
. The former allows anonymous traffic but the latter returns 401 Unauthorized. This issues does not happen when using a servlet web app.
To Reproduce
- Create a new Spring Boot project using WebFlux, Actuator, and Spring Security
- Attempt to remove security from actuator endpoints other than the root
/actuator
Expected behavior
Endpoints defined as .permitAll()
without an overriding definition should allow anonymous access.
Sample
Demo Project
Reactive Security Bug.postman_collection.json.txt
@Configuration
@EnableWebFluxSecurity
@RequiredArgsConstructor
public class SecurityConfiguration {
private final ReactiveAuthenticationManager authenticationManager;
private final ServerSecurityContextRepository securityContextRepository;
@Bean
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
http
.csrf().disable()
.formLogin().disable()
.httpBasic().disable();
http
.authorizeExchange()
.pathMatchers(HttpMethod.GET, "/actuator", "/actuator/info", "/demo").permitAll()
.anyExchange().authenticated();
http
.authenticationManager(authenticationManager)
.securityContextRepository(securityContextRepository);
return http.build();
}
}
albertgarcias
Metadata
Metadata
Assignees
Labels
status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid