Allow first-party SameSite=None cookies in sandboxed contexts
- Category
- Miscellaneous
- Type
- New or changed feature
- Status
- In developer trial (Behind a flag) (Chrome In developer trial (Behind a flag))
- Intent stage
- None
WPT details: https://chromium-review.googlesource.com/c/chromium/src/+/6090256
Summary
Enable a frame to signal the browser to include SameSite=None cookies in first-party requests if third-party cookie (3PC) restrictions are active using the sandbox 'allow-same-site-none-cookies' value.
Motivation
To prevent malicious attacks from untrusted content, servers can include a Content-Security-Policy HTTP header or iframe attribute to sandbox a page. This policy results in the browser treating the page as an opaque origin, which prevents requests originating from this page from including SameSite=Strict/Lax cookies. Considering an example webpage at storage.example.com where users upload untrusted code, the owners may choose to sandbox the page to restrict user scripts from being run. Due to this sandboxing, only SameSite=None cookies can be used for access control. However, this creates an issue if third-party cookies (3PCs) are blocked— particularly for sandboxed frames that are same-site with respect to the top-level site (including possibly the top-level frame itself). All subresource requests from storage.example.com would be considered cross-site in the context of 3PC blocking and requests from these sandboxed pages will no longer even have their SameSite=None cookies. Even though the cookies are not being sent in a truly cross-site context, access-controlled content such as embedded media would not be included on the page. This proposal allows servers to restore existing behavior and ensure these cookies are included in same-site requests, which can mitigate potential 3PC-blocking-related breakage.
Standards & signals
- Specification: https://github.com/whatwg/html/pull/10915
- Firefox: Positive
- Safari: No signal — (we discussed this with them and got tentatively positive feedback)
- Web developers: Positive — (see public feedback, we also received a private signal of developer demand)
- Tracking bug: https://g-issues.chromium.org/u/0/issues/372894175
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=allow-first-party-samesite-none-cookies-in-sandboxed-contexts
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+Allow%20first-party%20SameSite%3DNone%20cookies%20in%20sandboxed%20contexts
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=Allow%20first-party%20SameSite%3DNone%20cookies%20in%20sandboxed%20contexts
- Baseline status: https://webstatus.dev/?q=Allow%20first-party%20SameSite%3DNone%20cookies%20in%20sandboxed%20contexts
Samples: https://sandbox-allow-same-site-none-cookies-demo.glitch.me/
Explainers: https://github.com/explainers-by-googlers/csp-sandbox-allow-same-site-none-cookies