Skip to content

Wrong evaluation of anyRequestFilterChain #16217

Closed
@coinzz

Description

@coinzz

Describe the bug
After upgrading from Spring Boot 3.3.X to 3.4.0, thus using Spring Security 6.4.0 we encountered the problem, that we think that the evaluation of anyRequestFilterChain is not handled correctly. We have 2 filter chains, the first one was correctly identified as anyRequestFilterChain, while the second one is matching on /login. The problem we think is, that the evaluation happens too early, it should happen in Line 316 and not in 308 as seen in the screenshot. Do you agree with that, or did we understand something wrong?

default-security-error

To Reproduce
Add two filterChains, one with anyRequest and one with e.g. /login as seen in the code example below.

Expected behavior
We believe this configuration should not result in the error, that there are more than one filter chain that matches any request.

Sample

Add these two Beans to a Configuration:

	@Bean
	public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
		httpSecurity.csrf(AbstractHttpConfigurer::disable);

		return httpSecurity.build();
	}

	@Bean
	public SecurityFilterChain defaultLoginFormFilterChain(HttpSecurity http) throws Exception {
		return http.securityMatcher("/login")
				.authorizeHttpRequests(authorize -> authorize.anyRequest()
						.permitAll())
				.formLogin(formLogin -> formLogin.defaultSuccessUrl("/swagger-ui/index.html"))
				.build();
	}

Reports that include a sample will take priority over reports that do not.
At times, we may require a sample, so it is good to try and include a sample up front.

Metadata

Metadata

Assignees

Labels

status: invalidAn issue that we don't feel is validtype: bugA general bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions