Conversation
Two Spring behaviors that tests depend on were undocumented: a @SessionScope or @requestScope bean is resolved per user in multi-user tests, where the second user used to reuse the first user's instance, and the mocked request rotates the session ID on login instead of throwing, so session-fixation protection can be tested. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two Spring behaviors that a test relies on were not written down anywhere:
vaadin/browserless-test#111— in a multi-user test, a@SessionScopeor@RequestScopebean is resolved against the active user's own request. Before 1.1.2 every user resolved such a bean against one request, so the second user reused the first user's instance, and a bean holding a local signal failed with the cross-session error. The Pitfalls and Guarantees list covers the security snapshot and the thread-locals, but said nothing about Spring's own scopes.vaadin/browserless-test#208—HttpServletRequest.changeSessionId()used to throwUnsupportedOperationExceptionin the mocked environment, which meant a login flow that protects against session fixation could not run in a test. The mocked request now rotates the ID and keeps the session, its attributes, and theVaadinSessionbound to it.What changed
multi-user.adoc, Pitfalls and Guarantees — one bullet for the per-user scopes, with the note that@VaadinSessionScopehas always behaved this way because it resolves againstVaadinSession.getCurrent().spring-security.adoc— a Session Fixation Protection section: what rotates the ID, what survives the rotation, and a snippet asserting the new ID.Notes for the reviewer
V25.2badge. The session ID rotation shipped in 1.2.0-rc1, henceV25.3on the new section.How to test
Documentation only, with an inline snippet that is not compiled. The behavior matches
MockRequestTestand the multi-user Spring tests onvaadin/browserless-testmain.🤖 Generated with Claude Code