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

Initializing a document's CSP list requires synchronous cross-process access #389

Open
bzbarsky opened this issue Apr 23, 2019 · 5 comments
Labels
needs-info Indicates an issue that is blocked waiting for a response or investigation

Comments

@bzbarsky
Copy link

https://w3c.github.io/webappsec-csp/#initialize-document-csp step 1.1 examines "request’s client’s global object’s CSP list". The request's client's global object can be in a different process in a variety of cases: noopener/noreferrer loads, sandboxed documents with process-per-origin, data: documents with process-per-origin, etc.

I thought this had been discussed before and what Chrome actually does is store a snapshot of the client's CSP on the load and then initialize from that, but I can't find an existing issue tracking this. If that's what Chrome does (and this is what I think I'd like Firefox to do), then it's observably different from the spec as written right now if the CSP of the client global is mutated (via <meta>) between the load start and the initialization of the resulting document, and we should be able to write tests for this...

@annevk @mikewest @andypaicu @ckerschb @dveditz

@mbrodesser-Igalia
Copy link
Contributor

https://w3c.github.io/webappsec-csp/#initialize-document-csp step 1.1 examines "request’s client’s global object’s CSP list".

Now, that section seems to have been replaced by https://w3c.github.io/webappsec-csp/#run-document-csp-initialization.
That doesn't examine "request’s client’s global object’s CSP list" any longer. The "request’s client’s global object’s CSP list" is still accessed by https://w3c.github.io/webappsec-csp/#should-block-navigation-request; so this might still be an issue.

The request's client's global object can be in a different process in a variety of cases: noopener/noreferrer loads, sandboxed documents with process-per-origin, data: documents with process-per-origin, etc.

I thought this had been discussed before and what Chrome actually does is store a snapshot of the client's CSP on the load and then initialize from that, but I can't find an existing issue tracking this. If that's what Chrome does (and this is what I think I'd like Firefox to do), then it's observably different from the spec as written right now if the CSP of the client global is mutated (via <meta>) between the load start and the initialization of the resulting document, and we should be able to write tests for this...

@annevk @mikewest @andypaicu @ckerschb @dveditz

@antosart
Copy link
Member

It's not clear to me what the issue is, can you help clarify? I believe Chrome currently correctly implements the spec wrt the navigational check. The initiator's CSP (i.e. request's client's global object's CSP list) is snapshotted when the navigation is initiated).

@ciaramcmullin ciaramcmullin added the needs-info Indicates an issue that is blocked waiting for a response or investigation label Jan 13, 2025
@bzbarsky
Copy link
Author

bzbarsky commented Feb 6, 2025

@antosart The issue is that the spec, when it talks about "request’s client’s global object’s CSP list", is currently talking about at the list at the point in time when it talks about it, not when navigation started.

Since the lists are mutable, snapshotting the list at start of navigation is not in fact a correct implementation of the spec as it was when this issue was filed.

@antosart
Copy link
Member

antosart commented Feb 7, 2025

I believe this has been fixed by #692.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-info Indicates an issue that is blocked waiting for a response or investigation
Projects
None yet
Development

No branches or pull requests

5 participants