Skip to content

CookieSameSiteSupplier influences session cookie #39766

Closed
@cbrachem

Description

@cbrachem

When upgrading an application from Spring Boot 2.7 to 3.2, we noticed a change in behavior for the session cookie. In 3.2, it uses the SameSite attribute provided by a CookieSameSiteSupplier bean. This is not the case in 2.7, where only setting the server.servlet.session.cookie.same-site config property influences the session cookie. I think the change was introduced with the upgrade to Jetty 10. Now, creating the session cookie goes through the SuppliedSameSiteCookieHandlerWrapper.
Mitigating the effects of this change is trivial (just adapt the CookieSameSiteSupplier bean to exclude the session cookie by name), but I would like to have the documentation match the actual behavior. At the time of writing this, it says:

If you want to change the SameSite attribute on other cookies added to your HttpServletResponse, you can use a CookieSameSiteSupplier

which imho implies that it does not affect the session cookie.

Changing the documentation and maybe adding a note for a breaking change in behavior is probably the easiest fix, and even allows for more flexible configuration as seen here, for example. I haven't looked into the alternative yet, i.e. making the CookieSameSiteSupplier not affect the session cookie, but I'm willing to bring a PR either way if this is to be fixed.

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions