Skip to content

Commit 3ac64ea

Browse files
committed
Add the Origin-Isolation header
See https://github.com/WICG/origin-isolation.
1 parent c9fddd7 commit 3ac64ea

File tree

1 file changed

+188
-49
lines changed

1 file changed

+188
-49
lines changed

source

Lines changed: 188 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,7 +2460,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
24602460

24612461
<ul class="brief">
24622462
<li><dfn data-x="http-structured-header" data-x-href="https://httpwg.org/http-extensions/draft-ietf-httpbis-header-structure.html">structured header</dfn></li>
2463-
<li><dfn data-x="http-structured-header-token" data-x-href="https://httpwg.org/http-extensions/draft-ietf-httpbis-header-structure.html#token">structured header tokens</dfn></li>
2463+
<li><dfn data-x="http-structured-header-token" data-x-href="https://httpwg.org/http-extensions/draft-ietf-httpbis-header-structure.html#token">token</dfn></li>
2464+
<li><dfn data-x="http-structured-header-boolean" data-x-href="https://httpwg.org/http-extensions/draft-ietf-httpbis-header-structure.html#boolean">boolean</dfn></li>
24642465
</ul>
24652466

24662467
<p>The following terms are defined in <cite>MIME Sniffing</cite>: <ref spec=MIMESNIFF></p>
@@ -2868,6 +2869,18 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
28682869
</dd>
28692870

28702871

2872+
<dt>WebAssembly</dt>
2873+
2874+
<dd>
2875+
<p>The following term is defined in <cite>WebAssembly JavaScript Interface</cite>: <ref
2876+
spec=WASMJS></p>
2877+
2878+
<ul class="brief">
2879+
<li><dfn data-x-href="https://webassembly.github.io/spec/js-api/#module"><code>WebAssembly.Module</code></dfn></li>
2880+
</ul>
2881+
</dd>
2882+
2883+
28712884
<dt>DOM</dt>
28722885

28732886
<dd>
@@ -76616,7 +76629,7 @@ popup4.close();</code></pre></div>
7661676629

7661776630
<li><p>Let <var>agent</var> be the result of <span
7661876631
data-x="obtain-similar-origin-window-agent">obtaining a similar-origin window agent</span> given
76619-
<var>origin</var> and <var>group</var>.</p></li>
76632+
<var>origin</var>, <var>group</var>, and false.</p></li>
7662076633

7662176634
<li>
7662276635
<p>Let <var>realm execution context</var> be the result of <span>creating a new JavaScript
@@ -77211,6 +77224,15 @@ console.assert(iframeWindow.frameElement === null);
7721177224
isolated</span> is under discussion in <a href="https://github.com/whatwg/html/pull/4734">issue
7721277225
#4734</a>.</p>
7721377226

77227+
<p>A <span>browsing context group</span> has an associated <dfn>historical agent cluster key
77228+
map</dfn>, which is a <span data-x="ordered map">map</span> of <span
77229+
data-x="origin">origins</span> to <span data-x="agent cluster key">agent cluster keys</span>. This
77230+
map is used to ensure the consistency of the <a href="#origin-isolation">origin isolation</a>
77231+
feature by recording what agent cluster keys were previously used for a given origin.</p>
77232+
77233+
<p class="note">The <span>historical agent cluster key map</span> only ever gains entries over the
77234+
lifetime of the browsing context group.</p>
77235+
7721477236
<p>To <dfn data-x="creating a new browsing context group">create a new browsing context
7721577237
group</dfn>, run these steps:</p>
7721677238

@@ -77910,6 +77932,7 @@ interface <dfn data-export="" data-dfn-type="interface">Window</dfn> : <span>Eve
7791077932
// the user agent
7791177933
readonly attribute <span>Navigator</span> <span data-x="dom-navigator">navigator</span>; <!-- IE also has window.clientInformation === window.navigator -->
7791277934
[SecureContext] readonly attribute <span>ApplicationCache</span> <span data-x="dom-applicationCache">applicationCache</span>;
77935+
[SecureContext] readonly attribute boolean <span data-x="dom-originIsolationRestricted">originIsolationRestricted</span>;
7791377936

7791477937
// user prompts
7791577938
void <span data-x="dom-alert">alert</span>();
@@ -79534,7 +79557,8 @@ interface <dfn>BarProp</dfn> {
7953479557
<p>Can be set to a value that removes subdomains, to change the <span>origin</span>'s <span
7953579558
data-x="concept-origin-domain">domain</span> to allow pages on other subdomains of the same
7953679559
domain (if they do the same thing) to access each other. (Can't be set in sandboxed
79537-
<code>iframe</code>s.)</p>
79560+
<code>iframe</code>s, and setting it will do nothing if the <code>Document</code> is <a
79561+
href="#origin-isolation">origin-isolated</a>.)</p>
7953879562
</dd>
7953979563
</dl>
7954079564

@@ -79579,38 +79603,34 @@ interface <dfn>BarProp</dfn> {
7957979603
<li><p>Return true.</p></li>
7958079604
</ol>
7958179605

79582-
<p>The <dfn><code data-x="dom-document-domain">domain</code></dfn> attribute's getter must run
79583-
these steps:</p>
79606+
<p>The <dfn><code data-x="dom-document-domain">domain</code></dfn> getter steps are:</p>
7958479607

7958579608
<ol>
79586-
<li><p>Let <var>effectiveDomain</var> be this <code>Document</code> object's
79587-
<span>origin</span>'s <span data-x="concept-origin-effective-domain">effective domain</span>.
79609+
<li><p>Let <var>effectiveDomain</var> be <span>this</span>'s <span>origin</span>'s <span
79610+
data-x="concept-origin-effective-domain">effective domain</span>.
7958879611

7958979612
<li><p>If <var>effectiveDomain</var> is null, then return the empty string.</p></li>
7959079613

7959179614
<li><p>Return <var>effectiveDomain</var>, <span data-x="host
7959279615
serializer">serialized</span>.</p></li>
7959379616
</ol>
7959479617

79595-
<p>The <code data-x="dom-document-domain">domain</code> attribute's setter must run these
79596-
steps:</p>
79618+
<p>The <code data-x="dom-document-domain">domain</code> setter steps are:</p>
7959779619

7959879620
<ol>
79599-
<li><p>If this <code>Document</code> object's <span data-x="concept-document-bc">browsing
79600-
context</span> is null, then throw a <span>"<code>SecurityError</code>"</span>
79601-
<code>DOMException</code>.</p></li>
79621+
<li><p>If <span>this</span>'s <span data-x="concept-document-bc">browsing context</span> is null,
79622+
then throw a <span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>
7960279623

79603-
<li><p>If this <code>Document</code> object's <span>active sandboxing flag set</span> has its
79604-
<span>sandboxed <code data-x="dom-document-domain">document.domain</code> browsing context
79605-
flag</span> set, then throw a <span>"<code>SecurityError</code>"</span>
79606-
<code>DOMException</code>.</p></li>
79624+
<li><p>If <span>this</span>'s <span>active sandboxing flag set</span> has its <span>sandboxed
79625+
<code data-x="dom-document-domain">document.domain</code> browsing context flag</span> set, then
79626+
throw a <span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>
7960779627

79608-
<li><p>If this <code>Document</code> object is not <span>allowed to use</span> the "<code
79628+
<li><p>If <span>this</span> is not <span>allowed to use</span> the "<code
7960979629
data-x="document-domain-feature">document-domain</code>" feature, then throw a
7961079630
<span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>
7961179631

79612-
<li><p>Let <var>effectiveDomain</var> be this <code>Document</code> object's
79613-
<span>origin</span>'s <span data-x="concept-origin-effective-domain">effective domain</span>.
79632+
<li><p>Let <var>effectiveDomain</var> be <span>this</span>'s <span>origin</span>'s <span
79633+
data-x="concept-origin-effective-domain">effective domain</span>.
7961479634

7961579635
<li><p>If <var>effectiveDomain</var> is null, then throw a
7961679636
<span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>
@@ -79619,7 +79639,18 @@ interface <dfn>BarProp</dfn> {
7961979639
a registrable domain suffix of and is not equal to</span> <var>effectiveDomain</var>, then throw
7962079640
a <span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>
7962179641

79622-
<li><p>Set this <code>Document</code> object's <span>origin</span>'s <span
79642+
<li>
79643+
<p>If the <span>surrounding agent</span>'s <span>agent cluster</span>'s <span>origin-isolation
79644+
restricted</span> is true, then return.</p>
79645+
79646+
<p class="note">In this case the <code>Document</code> is <a
79647+
href="#origin-isolation">origin-isolated</a>, either explicitly by using the `<code
79648+
data-x="http-origin-isolation">Origin-Isolation</code>` header, or automatically because a
79649+
previous same-origin <code>Document</code> in the same <span>browsing context group</span> used
79650+
the header.</p>
79651+
</li>
79652+
79653+
<li><p>Set <span>this</span>'s <span>origin</span>'s <span
7962379654
data-x="concept-origin-domain">domain</span> to the result of <span data-x="host
7962479655
parser">parsing</span> the given value.</p></li>
7962579656
</ol>
@@ -79637,6 +79668,69 @@ interface <dfn>BarProp</dfn> {
7963779668
used.</p>
7963879669

7963979670

79671+
<h4>Origin isolation</h4>
79672+
79673+
<dl class="domintro">
79674+
<dt>window . <code subdfn data-x="dom-originIsolationRestricted">originIsolationRestricted</code></dt>
79675+
79676+
<dd>
79677+
<p>Returns true if the origin isolation restrictions are in place for this <code>Window</code>,
79678+
i.e., if the `<code data-x="http-origin-isolation">Origin-Isolation</code>` header has been used
79679+
to prevent using <code data-x="dom-document-domain">document.domain</code> or using
79680+
<code data-x="dom-window-postMessage">postMessage()</code> to send a
79681+
<code>WebAssembly.Module</code> to a cross-origin <code>Window</code>.</p>
79682+
79683+
<p>The returned value generally reflects whether the `<code
79684+
data-x="http-origin-isolation">Origin-Isolation</code>` HTTP response header was applied while
79685+
loading the current page. However, even if the header is omitted, the returned value can be
79686+
true, if the header was applied to a previously-loaded same-origin page in the
79687+
<code>Window</code>'s <span>browsing context group</span>. Similarly, even if the header was
79688+
present, the returned value can be false, if the header was omitted on a previously-loaded
79689+
same-origin page in the <code>Window</code>'s <span>browsing context group</span>.</p>
79690+
</dd>
79691+
</dl>
79692+
79693+
<p>A <code>Document</code> delivered over a <span data-x="Is environment settings object a secure
79694+
context?">secure context</span> can opt in to origin isolation, by using the `<code
79695+
data-x="http-origin-isolation">Origin-Isolation</code>` HTTP response header. This header is a
79696+
<span data-x="http-structured-header">structured header</span> whose value must be a <span
79697+
data-x="http-structured-header-boolean">boolean</span>. <ref spec=STRUCTURED-HEADERS></p>
79698+
79699+
<p><span w-nodev>Per the processing model in the <span data-x="create-the-document-object">create
79700+
and initialize a new <code>Document</code> object</span>, values</span><span
79701+
w-nohtml>Values</span> that are not the <span data-x="http-structured-header-boolean">structured
79702+
header boolean</span> true value (i.e., `<code data-x="">?1</code>`) will be ignored.</p>
79703+
79704+
<p>The consequences of using this header are that <span w-nodev>the resulting
79705+
<code>Document</code>'s <span>agent cluster key</span> is its <span>origin</span>, instead of the
79706+
<span data-x="obtain a site">corresponding site</span>. In terms of observable effects, this means
79707+
that </span>attempting to <a href="#relaxing-the-same-origin-restriction">relax the same-origin
79708+
restriction</a> using <code data-x="dom-document-domain">document.domain</code> will instead do
79709+
nothing, and it will not be possible to send <code>WebAssembly.Module</code> objects to
79710+
cross-origin <code>Document</code>s (even if they are <span>same site</span>). Behind the scenes,
79711+
this isolation can allow user agents to allocate implementation-specific resources corresponding
79712+
to <span data-x="agent cluster">agent clusters</span>, such as processes or threads, more
79713+
efficiently.</p>
79714+
79715+
<p>Note that within a <span>browsing context group</span>, the `<code
79716+
data-x="http-origin-isolation">Origin-Isolation</code>` header can never cause same-origin
79717+
<code>Document</code> objects to end up in different <span data-x="agent cluster">agent
79718+
clusters</span>, even if one sends the header and the other doesn't.<span w-nodev> This is
79719+
prevented by means of the <span>historical agent cluster key map</span>.</span></p>
79720+
79721+
<div w-nodev>
79722+
79723+
<p>The <dfn><code data-x="dom-originIsolationRestricted">originIsolationRestricted</code></dfn>
79724+
getter steps are to return the <span>surrounding agent</span>'s <span>agent cluster</span>'s
79725+
<span>origin-isolation restricted</span> value.</p>
79726+
79727+
<p class="note"><code>Document</code>s for which <span>obtain a site</span> returns an
79728+
<span>origin</span> can be considered unconditionally origin isolated; for them, the header has no
79729+
effect. In those cases the <code
79730+
data-x="dom-originIsolationRestricted">originIsolationRestricted</code> getter returns false,
79731+
since no additional restrictions were imposed by origin isolation.</p>
79732+
79733+
</div>
7964079734

7964179735

7964279736
<h3>Sandboxing</h3>
@@ -82705,10 +82799,20 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
8270582799
<p>Otherwise:</p>
8270682800

8270782801
<ol>
82802+
<li><p>Let <var>oiHeader</var> be the result of <span
82803+
data-x="concept-response-header-list-get-structured-header">getting a structured header</span>
82804+
given `<code data-x="http-origin-isolation">Origin-Isolation</code>` and "<code
82805+
data-x="">item</code>" from <var>response</var>'s <span
82806+
data-x="concept-response-header-list">header list</span>.</p></li>
82807+
82808+
<li><p>Let <var>requestsOI</var> be true if <var>oiHeader</var> is not failure,
82809+
<var>oiHeader</var> is not null, and <var>oiHeader</var>[0] is the <span
82810+
data-x="http-structured-header-boolean">boolean</span> true.</p></li>
82811+
8270882812
<li><p>Let <var>agent</var> be the result of <span
82709-
data-x="obtain-similar-origin-window-agent">obtaining a similar-origin window agent</span> given
82710-
<var>origin</var> and <var>browsingContext</var>'s <span data-x="tlbc
82711-
group">group</span>.</p></li>
82813+
data-x="obtain-similar-origin-window-agent">obtaining a similar-origin window agent</span>
82814+
given <var>origin</var>, <var>browsingContext</var>'s <span data-x="tlbc group">group</span>,
82815+
and <var>requestsOI</var>.</p></li>
8271282816

8271382817
<li>
8271482818
<p>Let <var>realm execution context</var> be the result of <span>creating a new JavaScript
@@ -89099,58 +89203,70 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
8909989203

8910089204
<div w-nodev>
8910189205

89206+
<p>An <span>agent cluster</span> has an associated <dfn>origin-isolation restricted</dfn> boolean,
89207+
which is initially false.</p>
89208+
8910289209
<hr>
8910389210

8910489211
<p>The following defines the allocation of the <span data-x="agent cluster">agent clusters</span>
8910589212
of <span data-x="similar-origin window agent">similar-origin window agents</span>.</p>
8910689213

89107-
<p>An <dfn>agent cluster key</dfn> is a <span>site</span>.</p>
89214+
<p>An <dfn>agent cluster key</dfn> is a <span>site</span> or a <span
89215+
data-x="concept-origin-tuple">tuple origin</span> whose <span
89216+
data-x="concept-origin-host">host</span>'s <span>registrable domain</span> is non-null. I.e., an
89217+
<span>agent cluster key</span> can be either a <span>scheme-and-registrable-domain</span> or any
89218+
<span>origin</span>.</p>
8910889219

89109-
<p class="XXX"><a href="https://github.com/whatwg/html/pull/4734">whatwg/html #4734</a> is
89110-
expected to widen <span>agent cluster key</span> (but not <span>site</span>) to encompass all
89111-
<span data-x="concept-origin-tuple">tuple origins</span>.</p>
89220+
<p id="obtain-browsing-agent-cluster">To <dfn data-x="obtain-similar-origin-window-agent">obtain a
89221+
similar-origin window agent</dfn>, given an <span>origin</span> <var>origin</var>, a
89222+
<span>browsing context group</span> <var>group</var>, and a boolean <var>requestsOI</var>, run
89223+
these steps:</p>
8911289224

89113-
<p>To <dfn data-x="obtain-agent-cluster-key">obtain an agent cluster key</dfn>, given an origin
89114-
<var>origin</var>, return the result of <span data-x="obtain a site">obtaining a site</span> with
89115-
<var>origin</var>.</p>
89225+
<ol>
89226+
<li><p>Let <var>site</var> be the result of <span data-x="obtain a site">obtaining a site</span>
89227+
given <var>origin</var>.</p></li>
8911689228

89117-
<p>To <dfn data-x="obtain-similar-origin-window-agent">obtain a similar-origin window agent</dfn>,
89118-
given an <span>origin</span> <var>origin</var> and <span>browsing context group</span>
89119-
<var>group</var>, run these steps:</p>
89229+
<li id="obtain-agent-cluster-key"><p>Let <var>key</var> be <var>site</var> and let
89230+
<var>oiRestricted</var> be false.</p></li>
8912089231

89121-
<ol>
89122-
<li><p>Let <var>clusterKey</var> be the result of <span
89123-
data-x="obtain-agent-cluster-key" data-export="">obtaining an agent cluster key</span> given
89124-
<var>origin</var>.</p></li>
89232+
<li>
89233+
<p>If all of the following hold:</p>
8912589234

89126-
<li><p>Let <var>agentCluster</var> be the result of <span
89127-
data-x="obtain-browsing-agent-cluster">obtaining a browsing context agent cluster</span> with
89128-
<var>group</var> and <var>clusterKey</var>.</p></li>
89235+
<ul class="brief">
89236+
<li><var>requestsOI</var> is true</li>
8912989237

89130-
<li><p>Return the single <span>similar-origin window agent</span> contained in
89131-
<var>agentCluster</var>.</p></li>
89132-
</ol>
89238+
<li><var>site</var> is not equal to <var>origin</var></li>
8913389239

89134-
<p>To <dfn data-x="obtain-browsing-agent-cluster">obtain a browsing context agent cluster</dfn>,
89135-
given a <span>browsing context group</span> <var>group</var> and <span>agent cluster key</span>
89136-
<var>key</var>, run these steps:</p>
89240+
<li><var>group</var>'s <span>historical agent cluster key map</span>[<var>origin</var>] either
89241+
<span data-x="map exists">does not exist</span> or equals <var>origin</var></li>
89242+
</ul>
89243+
89244+
<p>then set <var>key</var> to <var>origin</var> and set <var>oiRestricted</var> to true.</p>
89245+
</li>
8913789246

89138-
<ol>
8913989247
<li>
8914089248
<p>If <var>group</var>'s <span>agent cluster map</span>[<var>key</var>] <span data-x="map
89141-
exists">does not exist, then:</span></p>
89249+
exists">does not exist</span>, then:</p>
89250+
8914289251
<ol>
8914389252
<li><p>Let <var>agentCluster</var> be a new <span>agent cluster</span>.</p></li>
8914489253

8914589254
<li><p>Add the result of <span data-x="create an agent">creating an agent</span>, given false,
8914689255
to <var>agentCluster</var>.</p></li>
8914789256

89257+
<li><p>Set <var>agentCluster</var>'s <span>origin-isolation restricted</span> to
89258+
<var>oiRestricted</var>.</p></li>
89259+
8914889260
<li><p>Set <var>group</var>'s <span>agent cluster map</span>[<var>key</var>] to
8914989261
<var>agentCluster</var>.</p></li>
89262+
89263+
<li><p>Set <var>group</var>'s <span>historical agent cluster key map</span>[<var>origin</var>]
89264+
to <var>key</var>.</p></li>
8915089265
</ol>
8915189266
</li>
8915289267

89153-
<li><p>Return <var>group</var>'s <span>agent cluster map</span>[<var>key</var>].</p></li>
89268+
<li><p>Return the single <span>similar-origin window agent</span> contained in <var>group</var>'s
89269+
<span>agent cluster map</span>[<var>key</var>].</p></li>
8915489270
</ol>
8915589271

8915689272
<p class="note">This means that there is only one <span>similar-origin window agent</span> per
@@ -116219,6 +116335,29 @@ interface <dfn>External</dfn> {
116219116335
</dl>
116220116336

116221116337

116338+
<h3>`<dfn><code data-x="http-origin-isolation">Origin-Isolation</code></dfn>`</h3>
116339+
116340+
<p>This section describes a header for registration in the Permanent Message Header Field
116341+
Registry. <ref spec=RFC3864></p>
116342+
116343+
<dl>
116344+
<dt>Header field name:</dt>
116345+
<dd>Origin-Isolation</dd>
116346+
<dt>Applicable protocol:</dt>
116347+
<dd>http</dd>
116348+
<dt>Status:</dt>
116349+
<dd>standard</dd>
116350+
<dt>Author/Change controller:</dt>
116351+
<dd>WHATWG</dd>
116352+
<dt>Specification document(s):</dt>
116353+
<dd>
116354+
This document is the relevant specification.
116355+
</dd>
116356+
<dt>Related information:</dt>
116357+
<dd>None.</dd>
116358+
</dl>
116359+
116360+
116222116361
<h3 id="ping-from">`<dfn><code data-x="http-ping-from">Ping-From</code></dfn>`</h3>
116223116362

116224116363
<p>This section describes a header for registration in the Permanent Message Header Field

0 commit comments

Comments
 (0)