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

Allowing SameSite=None Cookies in First-Party Sandboxed Contexts #1165

Open
aamuley opened this issue Jan 16, 2025 · 5 comments
Open

Allowing SameSite=None Cookies in First-Party Sandboxed Contexts #1165

aamuley opened this issue Jan 16, 2025 · 5 comments

Comments

@aamuley
Copy link

aamuley commented Jan 16, 2025

Request for Mozilla Position on an Emerging Web Specification

Other information

When third-party cookies (3PC) are blocked by Chrome and Firefox, contexts with the Content-Security-Policy: sandbox header or <iframe> sandbox attribute are no longer able to use SameSite=None cookies. The frame must include the allow-same-origin value to use cookies, which relaxes many security protections including the opaque origin.

We want to restore existing behavior and enable a frame to signal the browser to include SameSite=None cookies in first-party requests from sandboxed frames when 3PC restrictions are active with the allow-same-site-none-cookies value

@tomrittervg
Copy link

cc @bvandersloot-mozilla

@artines1
Copy link

Thanks for your request. I have a few questions about this proposal.

  • You mentioned that the calculation is based on the document's URL. However, it's unclear whether or not the calculation needs to consider the ancestor chain.
  • Does this sandbox directive apply to document cookies? In your motivating scenario, the website owner can't use allow-same-origin, so I suppose the document cookie is unavailable. Should this new directive preserve the same behavior, or will it apply further to document cookies?
  • Couldn’t the website owner use CHIPS to keep accessing Same-Site=None cookies when 3PCs are blocked?

@aamuley
Copy link
Author

aamuley commented Jan 23, 2025

  • You mentioned that the calculation is based on the document's URL. However, it's unclear whether or not the calculation needs to consider the ancestor chain.

I felt that considering the ancestor chain could be more of an implementation detail so I chose to omit that (although that will likely be required for the Chromium implementation). If this value is set in a cross-site embed, allowing the embedded frame to access a SameSite=None cookie from its domain seems like it would allow a 3PC. I can add this to the specification if this detail is agreed upon, just wanted to keep it broad to start.

  • Does this sandbox directive apply to document cookies? In your motivating scenario, the website owner can't use allow-same-origin, so I suppose the document cookie is unavailable. Should this new directive preserve the same behavior, or will it apply further to document cookies?

This directive will not apply to document cookies for the reasoning you mentioned. In sandboxed contexts, document.cookie calls requires allow-same-origin, which would make this directive a no-op.

  • Couldn’t the website owner use CHIPS to keep accessing Same-Site=None cookies when 3PCs are blocked?

Since the origin of the sandboxed document is opaque, I dont quite understand how adding a partitioned attribute would change this behavior since the context would still be considered cross-site for 3PC blocking regardless of the partitioned attribute.

Not sure how CHIPS is implemented in Mozilla but I would additionally assume for the CHIPS part, if the SiteForCookies of an opaque origin frame is cross-site to everything, the partition key generated from that should also not match any existing partition?

@johannhof
Copy link

I think we should discuss and specify the ancestor chain details, @aamuley maybe we could file an issue for that on the explainer?

That's also my understanding of the partition key, but it would be great if we had tests for this.

@artines1
Copy link

CHIPS cookies are allowed in cross-site contexts when 3PC is blocked, so I thought the SameSite=None cookies were still allowed. But you are correct that the partitionKey will be opaque origin in this case and cannot match any existing partition.

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

No branches or pull requests

4 participants