Skip to content

redact location.ancestorOrigins according to Referrer Policy #1918

Closed

Description

@hillbrad

@bzbarsky @dakami and I had a hallway discussion at the end of TPAC about the possibility of adding location.ancestorOrigins to Firefox. bz has had longstanding concerns about the information this leaks to child frames. We arrived at a local consensus that any leakage is roughly equivalent to what happens already with referrer, so it would make sense to redact ancestorOrigins according to referrer policy. (and this could resolve that objection to a Mozilla implementation of ancestorOrigins)

/cc @smaug---- @annevk

Activity

  1. domenic commented on Oct 17, 2016

    @domenic
    Member

    One big question, which I asked in the PR, is what does "redact" mean. Since it's an origin instead of a URL, several of the referrer policies don't really apply (e.g. maybe they're no-ops). If it gets censored completely (e.g. if the referrer policy is "no-referrer"), then does the resulting array contain null? The empty string? Or is that entry just missing, so that the number of entries in the array is less than the number of ancestor browsing contexts? We'll need a comprehensive spec for (origin, referrer policy) -> censored origin.

    Otherwise, I think we'd need to get a sense of what other user agents besides Firefox would be interested in this spec change. I guess only Chrome implements both referrer policy and ancestorOrigins, so... @mikewest, perhaps?

    As for WebKit and Edge, which don't implement referrer policy but do implement ancestorOrigins: does this sound reasonable to you, as something you would do if/when you eventually implemented referrer policy? Leaving aside any commitments to implementing referrer policy. Tagging the usual suspects... @cdumez @travisleithead. Please route to more appropriate people as necessary.

  2. added
    needs implementer interest
    security/privacy
    on Oct 17, 2016
  3. bzbarsky commented on Oct 17, 2016

    @bzbarsky
    Contributor

    The idea is that if the referrer policy allows the origin to leak out via the referrer (which I believe all policies except "no-referrer" do) then we should just go ahead and return the origin in ancestorOrigins. So this is really about the "no-referrer" case, plus any browser configuration that has equivalent effects.

    As for what value should be used in the "no-referrer" case, I don't have a strong opinion. Obvious options are "", null, "null" (this last as if the actual origin were a unique origin). Using "null" feels somewhat nice to me in that it's a situation that could arise even without the referrer policy business, so pages should be ready for it anyway. Using null would worry me in terms of pages getting exceptions when trying to string-manipulate the array entries.

  4. hillbrad commented on Oct 17, 2016

    @hillbrad
    Author

    I should write some test cases, but isn't the null case already possible today with GUID URL schemes? (data:, file:, etc.) And implicitly handled, as with CORS, by serializing to the string literal "null" according to RFC6454?

  5. domenic commented on Oct 17, 2016

    @domenic
    Member

    "null" sounds pretty good. (And it's according to the Unicode serialization of an origin, not some RFC ;).) But yeah, the PR as written just asks for the origin of the URL no-referrer, so we gotta straighten that out.

  6. hillbrad commented on Oct 17, 2016

    @hillbrad
    Author

    Well, this could be defined as basically a switch on the referrer policy states (which might be the most logical internal implementation choice), but I thought that calling out to the algorithm to produce a referrer and then extracting the origin via URL parsing would be more future compatible with new policy states that might be defined. I can revisit if that seems preferable.

  7. domenic commented on Oct 17, 2016

    @domenic
    Member

    IMO a switch makes the most sense, but adding it to the Referrer Policy spec would be best, since that ensures that whenever they add new policies they'll see that they need to update that algorithm as well.

  8. bzbarsky commented on Oct 17, 2016

    @bzbarsky
    Contributor

    The referrer may or may not be related to the origin in general (e.g. for a sandboxed iframe the referrer is based on its URL but the origin a unique origin). So going via some sort of "extract the referrer" algorithm to get a value to use in ancestorOrigins as is done in this PR isn't right.

  9. hillbrad commented on Oct 18, 2016

    @hillbrad
    Author
  10. bzbarsky commented on Oct 19, 2016

    @bzbarsky
    Contributor

    One thing that I'd like to check on, actually. What should happen if a page at origin A loads a subframe from origin A which then loads a page from origin B, if the original page is sending full referrers but the subframe is using the no-referrer policy?

  11. hillbrad commented on Oct 19, 2016

    @hillbrad
    Author

    I haven't spec'd it as a barrier or ratchet, but an individual query from a
    Location, to each ancestor, independent of any intermediate contexts and
    their policy states.

    On Tue, Oct 18, 2016 at 6:00 PM Boris Zbarsky notifications@github.com
    wrote:

    One thing that I'd like to check on, actually. What should happen if a
    page at origin A loads a subframe from origin A which then loads a page
    from origin B, if the original page is sending full referrers but the
    subframe is using the no-referrer policy?

    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub
    #1918 (comment), or mute
    the thread
    https://github.com/notifications/unsubscribe-auth/ACFbcC4lLs5fwF7n6Tv4A1Aes0OY-y36ks5q1WvHgaJpZM4KZEkb
    .

  12. bzbarsky commented on Oct 19, 2016

    @bzbarsky
    Contributor

    OK, but that will leak the origin of the topmost page in this case, when it should be able to have a reasonable expectation of no such leakage occurring, right?

  13. hillbrad commented on Oct 19, 2016

    @hillbrad
    Author

    Is that a reasonable expectation? Or should it set its own policy if it is
    concerned? Specifying a ratchet is much more difficult, btw, as the
    referrer policy options don't have a strict ordering.

  14. 47 remaining items

  15. dliebner commented on May 22, 2019

    @dliebner

    Browsers can determine if the user is a bot or not, as least as well as any external service. If this is communicated in a privacy preserving way then fraud could be detected more effectively without having to rely on surveillance.
    https://github.com/w3c/web-advertising/blob/master/admetrics.md

    That is useful, but the issue I'm talking about is running ads that are supposed to only be served on one site and running them on another site. The people seeing the ads will be legitimate users, but how will the ad tech know if the ads are being served on the intended site without the ancestor list?

  16. michael-oneill commented on May 22, 2019

    @michael-oneill

    In this proposal the browser will determine if they are being shown on the intended site, the ad tech only gets metrics from the Metrics Server e.g. Neilson or similar. Anything invalid gets ignored.

  17. SamB commented on Jul 28, 2019

    @SamB

    Browsers can determine if the user is a bot or not

    ... but wouldn't bots just use lying browsers?

  18. dliebner commented on Jul 28, 2019

    @dliebner

    It's not so much about detecting bots as it is about preventing malicious publishers from sending spoofed data via real users.

  19. jeffreytgilbert commented on Nov 18, 2019

    @jeffreytgilbert

    Problem statement:
    A full URL and the chain of domains can be read from within an iframe in a cross domain context via javascript. When used in conjunction with long-lived stable identifiers, behavioral information can be inferred and associated with the user identifier and deep behavioral profiles can be stored and resold over private data marketplaces unbeknownst to the user.

    This is the default case. The top level site does not have the ability to control this behavior.

    Proposed solution:
    Allow control of ancestorOrigin and referrer data by applying the Referrer Policy header/attribute to ancestorOrigin API. The default behavior, if no referrer policy is specified, is the same as historical ancestorOrigin behavior, which has an ordered list of domains.

    Regarding privacy, here’s my best semi-complete list for @dliebner and @opyh.

    A user should be able to opt into advertising and tracking for ad supported publisher content. For example:

    • Opt-Out (Truste, NAI, etc)
    • Opt-In (GDPR, CCPA, etc)
    • Apple's ITP
    • Do Not Track - DNT flag
    • Limit Ad Tracking - LMT flag
    • Content Blockers / Ad Blockers
    • In Private modes
    • Cross Site Tracking prevention
    • Block All Cookies settings

    A site (aka publisher) should expect to be able to restrict page content, including cross domain content such as ads, to appropriate usage. For example:

    • Content Security Policy headers (CSP)
    • IFrame sandbox attributes (akin to CSP)
    • Cross domain iframe sources
    • Referrer policy (via header or iframe attribute)
    • Feature policy (via header or iframe attribute)
    • SameSite cookie classification/restriction
    • Secure cookies
    • Ads.txt
    • Ads.cert

    It's probable that I missed some things here.

    Good news, bad news is… OpenRTB 3.0 has a possible solution using blockchain like signed ledgers to show the chain of changes to a bid request. The problem is, the adoption rate for OpenRTB is not fast. It's a big change and it's making some big assumptions about publishers, exchanges and networks willingness to adopt the new complexity and cost associated with implementing it. The biggest benefits are for adopters of header bidding. The biggest losers in this are probably ad networks, which is likely why there is a real reluctance to adopt this version. They married a good tasting thing with a bad tasting thing.

    You can read more on the certificate chain here: What is ads.cert?

    @opyh has some valid points related to not leaking the full browsing history of the user to advertisers. @dliebner also has valid points related to a trustworthy supply chain free of fraudulent publisher and exchange practices. My earlier comment is probably closer to an additional feature request for user level controls since this ticket addresses publisher level controls.

  20. added
    agenda+
    on Jul 15, 2024
  21. removed
    agenda+
    on Jul 18, 2024
  22. added a commit that references this issue on Aug 14, 2025
    691c50a
  23. added a commit that references this issue on Oct 27, 2025
    e18fbea
  24. added a commit that references this issue on Mar 5, 2026
    2568667
  25. added a commit that references this issue on Mar 11, 2026
    e161310
  26. added a commit that references this issue on Mar 31, 2026
    9e25701
  27. added
    topic: navigation
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

needs implementer interestnormative changesecurity/privacytopic: navigation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions