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

[Per-frame] Permission grants are usable by cross-site iframes #163

Open
cfredric opened this issue Feb 7, 2023 · 2 comments
Open

[Per-frame] Permission grants are usable by cross-site iframes #163

cfredric opened this issue Feb 7, 2023 · 2 comments
Labels
editorial This is not a normative change resolve before graduation These issues need to be resolved before the spec graduates from the CG

Comments

@cfredric
Copy link
Contributor

cfredric commented Feb 7, 2023

While working on the per-frame changes in Chromium, I've realized that there's a bit of an edge case that (IMO) does something unexpected.

Suppose a document on site A embeds two iframes (siblings) on sites B and C. Both iframes call document.requestStorageAccess() and both calls resolve. Now, say iframe C makes a subresource request to a URL on site B. Will this request be credentialed?

As currently specified, yes, I think it will (though the spec is a little hand-wavy in this area). By assumption, the C iframe's environment has the has storage access bit set, so the HTTP-network-or-cache fetch algorithm and document.cookie algorithms will use the relevant storage-access permission grant to attach cookies to the request. But the request's top-level site (A) and URL (B) mean that the permission grant which is relevant to the request is the one keyed by <A, B>. This grant cannot possibly have been obtained by the C iframe. So the C iframe is benefiting from the grant that its sibling obtained, not the one that it obtained on its own.

To me, it would seem more consistent to say that a given embedded context can only get access to its own cookies. I.e., that the C iframe can only send credentialed requests to C, regardless of what other permission grants have been created under the same top-level site.

Let me know what you all think. I think making this change would be positive from a security standpoint, but I'm not sure if there are legitimate use cases that would be broken by this restriction.

@annevk
Copy link
Collaborator

annevk commented Feb 7, 2023

I think the first paragraph of https://privacycg.github.io/storage-access/#cookies captures this intent, but the later paragraphs are indeed lacking.

From a browser architecture perspective it's also somewhat lacking that the website process would be able to hold this kind of authoritative state, but that's probably more reasonable to gloss over.

@johannhof
Copy link
Member

Yeah it's somewhat implied that fetch or the cookie store would do a same-site check between the request url origin and the embedded site, but I agree that this isn't clear enough. From my perspective I'd welcome a PR to that effect :)

@annevk annevk added resolve before graduation These issues need to be resolved before the spec graduates from the CG editorial This is not a normative change labels Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial This is not a normative change resolve before graduation These issues need to be resolved before the spec graduates from the CG
Projects
None yet
Development

No branches or pull requests

3 participants