#564: Deprecating `document.domain` setter.

Visit on Github.

Opened Oct 19, 2020

Guten TAG!

I would be thrilled if y'all could peruse the following suggestion that we start seriously looking into removing the document.domain setter from the platform.

We all know that document.domain's setter is a mechanism of weakening the same-origin policy to allow same-site-but-cross-origin documents direct DOM access to each other. This is unfortunate to begin with, but particularly so in light of Spectre and related side-channel attacks that have convinced us that aligning origins to processes is essential. document.domain makes it difficult to accurately commit documents into an origin-bound process, since its level of access to same-site documents could shift at runtime. Rather than asking developers to opt-out of this via COOP/COEP, Origin-Isolated, or Feature/Permission Policy, it would be ideal to first shift to an opt-in model, and then remove the mechanism entirely after usage is sufficiently low.

The proposal, then, entails the following:

  1. After a sufficient amount of communication with developers, shift the document-domain feature policy's allowlist from * to 'none'. This would break document.domain usage by default, allowing developers to opt-into it via Feature-Policy: document-domain 'src' or similar. (Here, it may be more compatible to shift from throwing an exception when the setter is disabled to simply ignoring its usage.)

  2. After driving down usage in step 1, shift to a more restrictive opt-in (enterprise policy, reverse origin trial, etc).

  3. After more usage disappears in step 2, remove the setter entirely.

  4. 🎉


Further details:

  • I have reviewed the TAG's API Design Principles
  • The group where the incubation/design work on this is being done (or is intended to be done in the future): The change is small enough that it would proceed through PRs against WHATWG specifications.
  • The group where standardization of this work is intended to be done ("unknown" if not known): WHATWG for HTML, WebAppSec for Feature/Permission Policy.
  • Existing major pieces of multi-stakeholder review or discussion of this design:
  • Major unresolved issues with or opposition to this design: Usage in the wild is high, something like ~0.4% of Chrome page views.
  • This work is being funded by: Google.

We'd prefer the TAG provide feedback as (please delete all but the desired option):

💬 leave review feedback as a comment in this issue and @-notify moi.

Discussions

2020-11-23

Minutes

Yves: the idea makes sense - but aparently there is dissagreement of how to meet that goal. There is a WICG proposal ... need to check that.

... needs more time on our side.

[bumped]

2020-11-30

Minutes

Dan: we had a brief discussion last week...

Tess: reading through most recent comments... I'm cautious about the compat stuff. Some good comments from Domenic & Anne. I like swapping the ... a way to get back to the old behavior if you need it. Doesn't help sites that aren't being actively maintained. We have to be careful of breaking sites that have no plausable path to being fixed... .. but this seems like a reasonable way to do it if you're gonna do it.

Tess: will leave a comment.

2021-01-11

Minutes

mike west response to Lea

Tess: it sounds like a 3x above the "removeal" threshold. If we could do this it would be great but we're skeptical for compat reasons. The numnbers are promising since its usage is declining. I think Mike has done a really good job of designing the process ... This sounds like a pretty sensible way to about it.

Dan: so what can we do with this issue?

Hadley: we should write up some kind of response "this seems risky but the approach seems good considering the risk" and propose close.

Yves: document.domain as Anne said is a way to do more isolation... isolation is done doing multiple other tweaks... there is still an issue of figuring out all the ways to do isolation here and explain them to developers so they can figure it out. While I agree it would be good, we need to get better understanding of isolation...

Dan: that could be a part of our feedback - that there should be a clea docuemntation of how to do isolation - e.g. on MDN - for developers.

2021-05-Arakeen

Minutes

Set to pending external feedback since Mike hasn't gotten back to us since January. Pinged him.

2021-12-Madripoor

Minutes

Dan: proposed text ...

Hi folks - we are looking at this at our virtual face to face and it looks like this has progressed signfigtantly with a new (tri-state) [proposal](https://github.com/mikewest/deprecating-document-domain/). That looks reasonmable though we have concerns around compat.  Is this work still in flux or is it appropriate for us to re-review at this time based on this propsoal?