GithubHelp home page GithubHelp logo

Comments (11)

estark37 avatar estark37 commented on June 12, 2024

I think this is desired behavior and was resolved in whatwg/html#1205, is that correct? (@domenic)

from webappsec-referrer-policy.

domenic avatar domenic commented on June 12, 2024

Right, I think we concluded that, with some of the extra formalization performed in whatwg/html#1205, the behavior described here is the desired one.

from webappsec-referrer-policy.

bzbarsky avatar bzbarsky commented on June 12, 2024

Why is that the desired behavior? The referrer is dynamically grabbed from the container document, but the referrer policy is snapshotted? Seems to me they should both be snapshots or both be dynamic.

from webappsec-referrer-policy.

domenic avatar domenic commented on June 12, 2024

Hmm, where is the referrer grabbed dynamically from the container document?

The document's referrer is a string (representing a URL) that can be set when the Document is created.

from webappsec-referrer-policy.

bzbarsky avatar bzbarsky commented on June 12, 2024

https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer step 3 substep 3 subsubsteps 2 and 3.

from webappsec-referrer-policy.

bzbarsky avatar bzbarsky commented on June 12, 2024

And note that https://html.spec.whatwg.org/#initialise-the-document-object does not set the referrer for srcdoc documents, because in step 9 the "If resource is a request" precondition is false: a srcdoc has a response but not a request. See https://html.spec.whatwg.org/#process-the-iframe-attributes

So for srcdoc documents the "document's referrer" is never set right now per spec, as far as I can tell. Luckily, https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer never tries to use it for a srcdoc document.

from webappsec-referrer-policy.

domenic avatar domenic commented on June 12, 2024

I see, you were talking about the referrer/referrer policy at fetching time, not document creation time. So about the referrer of requests initiated inside that document, not about document.referrer.

After thinking about this a bit more, I appreciate the asymmetry you are referring to. Roughly, when performing a request from "inside" an iframe srcdoc document:

  • We determine the referrer by saying "oh, the URL is meaningless (it's about:srcdoc); let's look up to the parent".
  • We should determinine the referrer policy by saying "oh, the referrer policy is unset; let's look up to the parent".

https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer step 3 substep 3 subsubsteps 2 and 3.

Hmm. These just seem wrong. For example it doesn't recursively climb. Yes it does, I missed the "while"

I'll send a couple of PRs here to straighten this out.

from webappsec-referrer-policy.

domenic avatar domenic commented on June 12, 2024

I gave this a shot but without #40 straightened out it's pretty hard.

The essential asymmetry is that referrer is computed "lazily" by using the value "client" by default; then "Determine request's referrer" takes over and gets a chance to climb iframe srcdocs and such. Whereas, referrer policy does not have this model: the request has a referrer policy, and if it's the default of "", then we don't know if that's because the request initiated from an iframe srcdoc document, or because it came from a normal document with no referrer policy set.

I'm not sure how to best to deal with this.

from webappsec-referrer-policy.

domenic avatar domenic commented on June 12, 2024

Oh, wait. Fetch already does this kind of lazy climbing for us, kind of:

If request's referrer policy is the empty string and request's client is non-null, then set request's referrer policy to request's client's associated referrer policy. [REFERRER]

We just need to make sure that works correctly for iframe srcdoc documents. Got it, HTML PR incoming.

from webappsec-referrer-policy.

bzbarsky avatar bzbarsky commented on June 12, 2024

So about the referrer of requests initiated inside that document, not about document.referrer

Yes! Sorry for the confusion there.

from webappsec-referrer-policy.

estark37 avatar estark37 commented on June 12, 2024

I believe this is fixed by whatwg/html@5d7c532 (@domenic please correct me if Im wrong!)

from webappsec-referrer-policy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.