spring-projects / spring-projects/spring-security

Wrong instance of FilterSecurityInterceptor used when multiple filter chains are active

Open
#4,437 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

There seems to be something fishy going on in WebSecurityConfigurerAdapter. The symptom is that users see JSP and thymeleaf authz tags evaluating using the wrong access rules - they get handed a FilterSecurityInterceptor from only one (the last ordered) WebSecurityConfigurer. If there are multiple WebSecurityConfigurers then each of them tries to set the "postBuildAction" in the global WebSecurity instance, and it is in that action that the WebSecurity acquires its single FilterSecurityInterceptor (whereas it seems it should be accumulating rules from each of the filter chains in order).

See https://github.com/spring-projects/spring-boot/issues/9696 for a sample.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing WebSecurityConfigurerAdapter and the postBuildAction configured on the global WebSecurity instance. Inspect how each FilterSecurityInterceptor is selected when multiple WebSecurityConfigurers create separate filter chains, and compare the behavior with JSP and Thymeleaf authorization tags. Done means those tags use the access rules from the applicable filter chain; the linked Spring Boot issue provides a reproduction example.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
authorization, security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.