spring-projects / spring-projects/spring-security

SessionFixationProtectionStrategy ignores create-session="never"

Open
#4,236 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

Summary

The SessionFixationProtectionStrategy class creates a new session, even if you have configured create-session="never".

Actual Behavior

The use case is that you want different urls to behave differently. For example:

Urls from "/example_1/" should not create a new session, but should use one if it exists
Urls from "/example_2/
" should create a session "if required"

Because the SessionFixationProtectionStrategy assumes that you always want to create a session if one already exists then this makes this desired behavior impossible.

This line is the culprit:

session = request.getSession(true); // we now have a new session

Expected Behavior

SessionFixationProtectionStrategy should not ignore create-session="never"

(The session should still be invalidated - just not a new one created)

Configuration

create-session="never" for some URLs and create-session="ifRequired" for otehr URLs.

Version

spring-security-web-3.2.5

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 reading SessionFixationProtectionStrategy, especially the request.getSession(true) path described in the issue, and trace how create-session="never" is applied for URL configuration. Reproduce the contrasting URL behavior with create-session="never" and create-session="ifRequired"; done means the existing session is invalidated without creating a replacement for the former case.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.