Skip to content

WebSession/WebSessionStore API are silent on saving a session that may have been invalidated [SPR-17051] #21589

@spring-projects-issues

Description

@spring-projects-issues

Yuriy Sazonets opened SPR-17051 and commented

DefaultWebSessionManager#save checks whether previously retrieved session is active (started) and not expired, but doesn't check if it actually exists in the session store.

Consider scenario:

  1. Long-running WebSocket request A.
  2. Logout during request A => session id gets changed.
  3. Request A ends and gets committed.
  4. DefaultWebSessionManager#save gets invoked with old session id (which is not valid anymore) and proceeds with saving.
  5. ReactiveRedisOperationsSessionRepository#save doesn't validate if the session passed in exists in the store, and just applies the delta (which in this case is only lastAccessedTime), which results in an broken session entry with only lastAccessedTime attribute.
  6. Subsequent requests to old session id fail because session data is inconsistent in the repository.

This causes major problems in production code. More details (and sample project to reproduce the issue) here: spring-projects/spring-session#1111


Affects: 5.0.7

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions