-
Notifications
You must be signed in to change notification settings - Fork 83
What does it mean to alias a policy from a CSP list? #207
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
Comments
What I take it to mean is just to insert a pointer to the parent policy in the CSP list of the child. I think that is consistent with the general idea of aliases as way to access the same memory space using different "names" or "handles". This could be spelled out in more details of course just to remove ambiguity. |
My point is that you have a "CSP list", which contains "policies". Policies are immutable as currently specced, as far as I can tell. The "CSP list" can be mutated by adding or removing policies. So there's no observable difference between copying and aliasing a policy, because policies are immutable anyway. If the idea is to "use whatever policies the parent/opener is using", you have to alias the "CSP list", not policies. |
@mikewest Can you please get this sorted out? Browsers are not interoperable here, which seems like a serious problem for CSP deployment... |
@mikewest, we just experienced a bug [1] where a page creates an iframe using
and then adds a meta CSP to that iframe. Since it's a same origin iframe, the iframe and the top-level page share the same principal. Ultimately, since the CSP hangs of the principal within Firefox, the CSP hoists to the embedding page and starts blocking content on the top-level document :-( It seems Chrome behaves differently. Even though it sounds odd, I am not sure Firefox behavior is wrong here. Anyway, what do you think? |
Thanks to you both for raising this. I agree that the language in the spec today isn't good. We should fix it together. I think that we should have typed something like "copy" rather than "alias" in a few places. That is, I think Chrome's behavior is what I'd like to keep, but we should chat about it. In the scenario you've spelled out, it seems valuable for a page to be able to break off a piece of itself and lock it down in a frame. Doing that in a way that doesn't persist the policy back up to the containing document is desirable in that case, as the framed page should have less privilege than the container. Would you be willing to build that kind of behavior into Firefox if we did a better job specifying it? Or do you think Firefox's behavior is what we ought to run with in general? Also, have you looked at Safari/Edge's behavior in the same scenario? If Chrome is the odd one out, I'm sure we can change our behavior instead. |
I personally think Chrome's behavior is more intuitive and Firefox wants to get away from having the CSP on the nsIPrincipal anyway. I think I am willing to change Firefox behavior if we can spell out the behavior more explicitly in the spec. |
Coincidentally I have a PR that replaces Is there anything else that should be spelled out? Is the concept of a |
What would need to be copied is the policy list, presumably. |
I will close this bug since everyone seems to be happy now. |
See w3c/webappsec-csp#207 for context. Tests: ??? Fixes #2594.
See w3c/webappsec-csp#207 for context. Tests: web-platform-tests/wpt#8520. Fixes #2594.
See w3c/webappsec-csp#207 for context. Tests: web-platform-tests/wpt#8520. Fixes whatwg#2594.
See w3c/webappsec-csp#207 for context. Tests: web-platform-tests/wpt#8520. Fixes whatwg#2594.
https://w3c.github.io/webappsec-csp/#initialize-document-csp talks about aliasing policies from opener/parent documents.
But as far as I can tell, policies are immutable, really. What can mutate is the "CSP list" of the document. For example, https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-content-security-policy calls https://w3c.github.io/webappsec-csp/#enforced which just inserts the policy into the CSP list. So what does it mean to alias things when initializing the document's CSP?
The text was updated successfully, but these errors were encountered: