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

Add referrer policy to blob-generated responses #306

Closed
wants to merge 1 commit into from

Conversation

domenic
Copy link
Member

@domenic domenic commented May 17, 2016

As discussed in whatwg/html#1205 (comment).

Don't have Anolis installed so you'll need to regenerate.

/cc @bzbarsky

@annevk
Copy link
Member

annevk commented May 18, 2016

So for about:blank we let HTML handle it?

@domenic
Copy link
Member Author

domenic commented May 18, 2016

I don't really know. I am just trying to make referrer policy parallel to HTTPS state. I don't understand the issue with about:blank for either of the two.

@bzbarsky
Copy link

The issue is this, for referrer policy: If you have a subframe that you never load anything into, and then you inject some elements into it that do loads, what should those loads use as the referrer and why?

@domenic
Copy link
Member Author

domenic commented May 18, 2016

The default referrer policy of "" (which in Fetch gets treated the same as "no-referrer-when-downgrade"), because there's no other natural choice?

@bzbarsky
Copy link

There is totally a natural choice: the referrer policy of the place where we get the referrer itself from: the parent page.

@bzbarsky
Copy link

Or put another way.... Whatever place it is that we propagate the value of referrer to things, we should propagate the value of the referrer policy in those same exact places. Anything else is just broken.

@domenic
Copy link
Member Author

domenic commented May 18, 2016

Oh, I see. You are of course right.

Yes, this should presumably be handled in HTML. It'd probably be done as part of w3c/webappsec-referrer-policy#40, since when we figure out how to apply <iframe referrerpolicy="whatever"> for the about:blank, we'll want to handle the fallback case too.

@domenic
Copy link
Member Author

domenic commented May 18, 2016

Ah! It's already taken care of, I just had some trouble finding it due to the way navigation has like four different algorithms involved. https://html.spec.whatwg.org/multipage/browsers.html#creating-a-new-browsing-context step 6.

@annevk
Copy link
Member

annevk commented May 19, 2016

Okay, so we don't have to fix this here? It does make more sense to handle this in HTML since a referrer policy is only relevant for something that ends up creating a document or worker.

@domenic
Copy link
Member Author

domenic commented May 19, 2016

No, I meant the about:blank case is taken care of. Blob URLs should still be consistent between HTTPS state and referrer policy...

@bzbarsky
Copy link

The initial about:blank case is taken care of by https://html.spec.whatwg.org/multipage/browsers.html#creating-a-new-browsing-context

What about non-initial about:blank?

@domenic
Copy link
Member Author

domenic commented May 19, 2016

I think as currently specced that will be handled by the navigate algorithm, which will get a "response" for about:blank that doesn't have any Referrer-Policy header, and so it will set the "" referrer policy.

@bzbarsky
Copy link

Yes, but what will it use for the referrer?

@domenic
Copy link
Member Author

domenic commented May 19, 2016

Presumably it would follow the normal navigate logic, and use the page that it was navigated from? @annevk might know better. But I'm not sure what's tricky about that case...

@bzbarsky
Copy link

No, I mean if you navigate your subframe to about:blank and then inject an <img> tag in there, what referrer will the image load use and why?

@domenic
Copy link
Member Author

domenic commented May 19, 2016

This is the responsibility of https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer. By my reading it will reach step 3.3.3 (referrerSource = "about:blank"), but then step 4 will set referrerURL to no referrer (since about: is a local scheme), which is what will be returned in step 6 (where the policy is "").

I can't actually find where Fetch invokes https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer; @annevk? The section https://w3c.github.io/webappsec-referrer-policy/#integration-with-fetch seems inaccurate.

@mkruisselbrink
Copy link
Collaborator

I can't actually find where Fetch invokes https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer

Main fetch step 8?

@domenic
Copy link
Member Author

domenic commented May 19, 2016

Ah yes, thanks. So then, assuming no referrer in Referrer Policy is the same as "no-referrer" in Fetch, I believe the resulting request will not have a referrer.

@bzbarsky
Copy link

OK. That seems fine, if it's what browsers do in practice...

Base automatically changed from master to main January 15, 2021 07:38
@annevk
Copy link
Member

annevk commented Jun 22, 2021

Thanks to @antosart policy container will be taking care of this. w3c/FileAPI#142 will track this going forward.

@annevk annevk closed this Jun 22, 2021
@annevk annevk deleted the copy-referrer-policy-for-blobs branch June 22, 2021 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants