[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thymeleaf CSRF injection can break session handling #222

Open
benjohnde opened this issue Jan 7, 2020 · 0 comments
Open

Thymeleaf CSRF injection can break session handling #222

benjohnde opened this issue Jan 7, 2020 · 0 comments

Comments

@benjohnde
Copy link

Configuration

Environment: Spring-Boot 2.1.9 with Thymeleaf 2.1.9.

Problem

The following error: Cannot create a session after the response has been committed occurred while handling parallel requests with SessionCreationPolicy.ifRequired (default).

Solution

Setting SessionCreationPolicy to always fixes the problem.

We assume that the automatic injection of the csrf token into a form (handled during template rendering with Thymeleaf) leads to a race condition which sometimes will be persisted after the response chain is executed. Thus no session for persisting the csrf token. We are not quite sure whether this is a bug of Thymeleaf, Spring-Boot or the pure Spring-Security framework.

Nonetheless as we assume that this bug may occur to multiple organisation we want to raise awareness of such an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant