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

Expose partitionedness #32

Open
annevk opened this issue May 18, 2022 · 10 comments
Open

Expose partitionedness #32

annevk opened this issue May 18, 2022 · 10 comments

Comments

@annevk
Copy link
Collaborator

annevk commented May 18, 2022

Exposing whether an environment is partitioned, mainly through an HTTP request header, came up in the last cookie discussion privacycg/meetings#19 (again). There's a couple different ideas floating around addressing various use cases around security and developer ergonomics.

#31 and #25 also relate to this in that for cookies people have suggested a different keying setup, which really drives home the point that we have to be very careful with what we end up doing in this space.


I think having an equivalent to Sec-Fetch-Site that tells you something about your ancestor documents (none, same-origin, same-site, or cross-site) still makes a lot of sense. However, in a A1 -> B -> A2 scenario this header would signal cross-site for A2, which might not make it clear enough it can still set SameSite=None cookies (depending on how #31 gets decided). It would indicate that CHIPS cookies would work however so maybe that is good enough. (The main alternative I can think of is that we'd expose a separate "what is my site relation with the top-level" header, but I'm not convinced that carries its weight.)

@arichiv
Copy link

arichiv commented Apr 10, 2024

If ancestor chain bit gets implemented for CHIPS, SameSite=None cookies would no longer be available in ABA contexts right? @johannhof

@johannhof
Copy link
Member

Ancestor chain bit just means it's partitioned by a different key, no? And of course they become available once storage access is granted. :)

@arichiv
Copy link

arichiv commented Apr 10, 2024

Ah, I'm conflating two things. Makes sense

@cfredric
Copy link

Exposing whether an environment is partitioned,

I think there are two main questions (each with a follow-up) that web developers may ask here:

  • Does this request include partitioned cookies (and have the ability to set new ones)?
    • If so, what is the partition key?
  • Does this request include unpartitioned cookies (and have the ability to set new ones)?
    • If not, would access be trivially granted via the Storage Access API (because the storage-access permission is either unnecessary or already granted)?

With that in mind, I think most of these would be satisfied by supporting two new sets of headers:

I think this neatly separates the question on partitioned cookies from the concern around A1 > B > A2 cookies mentioned above (and handles that concern gracefully, allowing server-side opt in if needed). I'd like to discuss supporting the combination of these headers, to see if others agree and support this work.

@cfredric cfredric added the agenda+ Request to add this issue to the agenda of our next telcon or F2F label Jul 30, 2024
@bvandersloot-mozilla
Copy link

Is there a particular reason you reached for Sec-Fetch-Ancestors rather than the Sec-Fetch-Partitioned proposal that answers partitionedness more directly?

@cfredric
Copy link

I haven't read through all of w3c/webappsec-fetch-metadata#80, but from what I've seen, I prefer Sec-Fetch-Ancestors because I think it provides more useful information. (I think it's also a bit ambiguous what "partitionedness" means, depending on who's asking. I.e., are they concerned about privacy, or security, or neither?)

IIUC, Sec-Fetch-Partitioned: ?1 would be the equivalent of something like (e.g.) Sec-Fetch-Top-Level-Document: ?0. (I'd argue that every iframe should be considered a "partitioned" context, since they can all set Partitioned cookies using some non-empty partition key.) I'm not aware of an existing Sec-Fetch- header that says whether the request came from a top-level document or not, so maybe it'd be useful.

However, I think that knowing the cross-site/same-site/same-origin-ness of the request context is more useful for web developers, since that gives a way to assess the security/privacy context that the request came from. I expect that to be what web developers are most commonly trying to assess, when asking whether the request is partitioned.

@bvandersloot-mozilla
Copy link

More detail seems like it could be worthwhile, in order to match the definition of Sec-Fetch-Site. But I'm not sure how much we want to add more headers versus adding enums. Data on the wire for every request seems expensive to me intuitively.

I expect that to be what web developers are most commonly trying to assess, when asking whether the request is partitioned.

I think so, but also the question "can I set unpartitioned cookies" seems like a common reasonable one that should have a simple answer. There is the javascript solution, but making it available on HTTP handling has been an open request IIRC.

@cfredric
Copy link

but also the question "can I set unpartitioned cookies" seems like a common reasonable one that should have a simple answer.

Agreed, but neither Sec-Fetch-Partitioned nor Sec-Fetch-Ancestors really answer that question. Storage Access Headers is aiming to answer that via Sec-Fetch-Storage-Access.

(Incidentally, that's a good example of why I think "is this partitioned" is sometimes ambiguous. It's possible for a context to be partitioned and also have access to unpartitioned cookies, so we need to be careful not to conflate "is partitioned" with "cannot access unpartitioned cookies".)

@erik-anderson erik-anderson removed the agenda+ Request to add this issue to the agenda of our next telcon or F2F label Aug 22, 2024
@bvandersloot-mozilla
Copy link

Sec-Fetch-Ancestors is probably the best then. It is weird that Sec-Fetch-Site has a semantic mismatch with the SameSite attribute, but it may be too hard to change it to SameSite's more strict definition.

It would be nice to get @annevk's latest take on it though!

@annevk
Copy link
Collaborator Author

annevk commented Nov 8, 2024

I gave feedback on the Sec-Fetch-Frame-Ancestors here: w3c/webappsec-fetch-metadata#89 (comment). I think with that incorporated it should be good.

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

6 participants