spring-projects / spring-projects/spring-security

In Spring Boot 3.0.2, `dispatcherServlet` is not working when combined with `filterChain` function

Open
#12,659 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I'm using spring-security in my project. After upgrading to Spring Boot 3.0.2, the dispatcherServlet seems not working.

I've composed a simple project here.

In the main branch, the project is backed by Spring Boot 2.7.8 and it's working.

Run the application
Run curl localhost:8080/topsecret, the terminal will return {"timestamp":"2023-02-12T21:26:39.147+00:00","status":403,"error":"Forbidden","path":"/topsecret"}

In the spring-boot3 branch, the project is backed by Spring Boot 3.0.0 and it's not working

Run the application
Run curl localhost:8080/topsecret in the terminal and nothing returns.
Note that apart from the dependency change, I only changed antMatchers to requestMatchers in here.
Additional reference on the spring-security's filterChain function.

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 with the linked secret-filter-chain-demo and compare the main and spring-boot3 branches, especially SecurityConfiguration.java where antMatchers became requestMatchers. Run the application and curl localhost:8080/topsecret on both branches; done means the Spring Boot 3 setup returns the expected 403 response instead of returning nothing.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.