spring-projects / spring-projects/spring-security
Session Control does not work properly when race condition happens
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Describe the bug
When login is performed by the same user multiple times from different internet browsers / devices, login can be performed successfully despite setting only 1 max session.
To Reproduce
Have the following code in the SecurityFilterChain
http.sessionManagement(sessionManagement -> {
sessionManagement.maximumSessions(1);
});
and when the race condition happens, the session count is 2 despite the above setting.
Expected behavior
Only the last login session should persist, all other sessions should be terminated.
Sample
I've done up a sample here.
Start the Spring Boot Application by the using the java class SecuringWebApplication.java
https://github.com/samueljz/spring-concurrency-issue/tree/main/complete
Race conditions can be introduced using tools such as Burp Suite.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the sample application's SecuringWebApplication.java and its SecurityFilterChain, then reproduce concurrent logins with maximumSessions(1), using the reported race-condition setup if available. Trace the session-control behavior during simultaneous logins; done means only the last login session persists and the session count does not exceed one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- authentication, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100