vvo / iron-session

🛠 Secure, stateless, and cookie-based session library for JavaScript
https://get-iron-session.vercel.app
MIT License
3.65k stars 251 forks source link

Support the `partitioned` attribute in cookie settings #706

Closed dysbulic closed 8 months ago

dysbulic commented 8 months ago

Google Chrome is in the process of phasing out third-party cookies.

There are a couple alternatives, one of the simplest being CHIPS: Cookies Having Independent Partitioned State which is triggered by the addition of a Partitioned attribute in the cookie header.

The documentation gives the following as an example compliant cookie:

Set-Cookie: __Host-name=value; Secure; Path=/; SameSite=None; Partitioned;

iron-session should support setting this attribute.

dysbulic commented 8 months ago

Actually, as I dig deeper, I find that the serialization of the cookie is handled by the cookies library which has support for partitioned as of the latest version.

For some reason the attribute doesn't work when specified in my cookieOptions when imported into Deno from https://esm.sh/iron-session@8.0.1 even though it imports the most recent version of cookies.

I have gotten it to set though on the example app included with iron-session.