-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Navigation fetch always uses document destination #11306
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
This seems to be working as intended. Can you explain further what the problem you're trying to solve is? |
By following the spec, frame-src CSP directives will never be consulted when deciding whether to block an iframe's navigation. |
We are trying to figure out why Servo isn't correctly checking CSP for iframes. @jdm are we maybe missing the steps in https://fetch.spec.whatwg.org/#ref-for-concept-request-destination%E2%91%A1%E2%91%A1 ? |
That's text for spec authors making use of the Fetch infrastructure from other specs. |
Navigation of an iframe starts with https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:navigate which in step 21.9 of https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate calls https://html.spec.whatwg.org/multipage/browsing-the-web.html#attempt-to-populate-the-history-entry's-document Here, the navigation params are empty, since that's only called for object or embed. Thus, we end up in https://html.spec.whatwg.org/multipage/browsing-the-web.html#create-navigation-params-by-fetching where we set the destination to document (rather than iframe). When that ends up in https://www.w3.org/TR/CSP3/#effective-directive-for-a-request we return |
I see, I guess that does seem like a bug. At this point I don't really understand what the intended architecture was here. CSP does indeed have some frame-ish destinations, but it also has initiators, and seems to imply that CSP should be using initiator instead of destination:
Do you know what existing browsers do? |
It seems that all browsers store this information in |
I see this in #6315:
I no longer see that text in the spec, so we apparently lost it at some point since then. |
No, wait, it's just further down the spec from where I originally linked it: step 8 of https://html.spec.whatwg.org/multipage/#create-navigation-params-by-fetching. Apologies for the confusion; this appears to be working as intended. |
Seems like we were not the first ones to be confused: #8383 Should we maybe add a hint in the spec text to make it clearer what the flow is here? |
@TimvdLippe if you have a concrete suggestion, ideally in the form of a PR, that would make it easier to consider. I'll reopen this for now to keep track of your request. |
To avoid confusion when implementers overlook the step where destination is updated to the correct navigable container. Fixes whatwg#11306 Fixes whatwg#8383
Sure thing! Opened #11318, but I don't know if a note can be rendered as part of a details table. Also, had to use GitHub codespaces, so not sure if I had to run a commit hook for formatting (I remember HTML spec does that) |
What is the issue with the HTML Standard?
https://html.spec.whatwg.org/multipage/browsing-the-web.html#create-navigation-params-by-fetching is the only time a request is created for navigation that I can see. It always uses the "document" destination for the request, even if the navigation occurs within an iframe. This has implications for other specifications like CSP, which use the destination to determine which directives to consult: https://www.w3.org/TR/CSP/#directive-algorithms
The text was updated successfully, but these errors were encountered: