Skip to content

Commit 60d1874

Browse files
authored
Add a noopener-allow-popups value to COOP
Some origins can contain different applications with different levels of security requirements. In those cases, it can be beneficial to prevent scripts running in one application from being able to open and script pages of another same-origin application. In such cases, it can be beneficial for a document to ensure its opener cannot script it, even if the opener document is a same-origin one. This adds a noopener-allow-popups Cross-Origin-Opener-Policy value that severs the opener relationship between the document loaded with this policy and its opener. At the same time, this document can open further documents (as the "allow-popups" in the name suggests) and maintain its opener relationship with them, assuming that their COOP policy allows it. Explainer: https://gist.github.com/yoavweiss/c7b61e97e6f8d207be619f87ab96ead5. Fixes #10373.
1 parent 0639fee commit 60d1874

File tree

1 file changed

+93
-17
lines changed

1 file changed

+93
-17
lines changed

source

Lines changed: 93 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -86803,6 +86803,46 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8680386803
`<code>Cross-Origin-Embedder-Policy</code>` header whose value is <span>compatible with
8680486804
cross-origin isolation</span> together.</p>
8680586805
</dd>
86806+
86807+
<dt>"<dfn><code data-x="coop-noopener-allow-popups">nooopener-allow-popups</code></dfn>"</dt>
86808+
<dd>
86809+
<p>This forces the creation of a new <span>top-level browsing context</span> for the document,
86810+
regardless of its predecessor.</p>
86811+
86812+
<div class="note">
86813+
<p>While including a <code
86814+
data-x="coop-noopener-allow-popups">nooopener-allow-popups</code> value severs the opener
86815+
relationship between the document on which it is applied and its opener, it does not create a
86816+
robust security boundary between those same-origin documents.</p>
86817+
86818+
<p>Other risks from same-origin applications include:</p>
86819+
86820+
<ul>
86821+
<li><p>Same-origin requests fetching the document's content — could be mitigated through
86822+
Fetch Metadata filtering. <ref>FETCHMETADATA</ref></p></li>
86823+
<li><p>Same-origin framing - could be mitigated through <code>X-Frame-Options</code> or CSP
86824+
<code data-x="frame-ancestors directive">frame-ancestors</code>.</p></li>
86825+
<li><p>JavaScript accessible cookies - can be mitigated by ensuring all cookies are <code
86826+
data-x="">httponly</code>.</p></li>
86827+
<li><p><code data-x="dom-localStorage">localStorage</code> access to sensitive data.</p></li>
86828+
<li><p>Service worker installation.</p></li>
86829+
<li><p><a href="https://w3c.github.io/ServiceWorker/#cache">Cache API</a> manipulation or
86830+
access to sensitive data. <ref>SW</ref></p></li>
86831+
<li><p><code data-x="">postMessage</code> or <code>BroadcastChannel</code> messaging that
86832+
exposes sensitive information.</p></li>
86833+
<li><p>Autofill which may not require user interaction for same-origin documents.</p></li>
86834+
</ul>
86835+
86836+
<p>Developers using <code data-x="coop-noopener-allow-popups">nooopener-allow-popups</code>
86837+
need to make sure that their sensitive applications don't rely on client-side features
86838+
accessible to other same-origin documents, e.g., <code
86839+
data-x="dom-localStorage">localStorage</code> and other client-side storage APIs,
86840+
<code>BroadcastChannel</code> and related same-origin communication mechanisms. They also need
86841+
to make sure that their server-side endpoints don't return sensitive data to non-navigation
86842+
requests, whose response content is accessible to same-origin
86843+
documents.</p>
86844+
</div>
86845+
</dd>
8680686846
</dl>
8680786847

8680886848
<div w-nodev>
@@ -86826,18 +86866,21 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8682686866
</ul>
8682786867

8682886868
<p>To <dfn data-x="matching-coop">match opener policy values</dfn>, given an <span>opener policy
86829-
value</span> <var>A</var>, an <span>origin</span> <var>originA</var>, an <span>opener policy
86830-
value</span> <var>B</var>, and an <span>origin</span> <var>originB</var>:</p>
86869+
value</span> <var>documentCOOP</var>, an <span>origin</span> <var>documentOrigin</var>, an
86870+
<span>opener policy value</span> <var>responseCOOP</var>, and an <span>origin</span>
86871+
<var>responseOrigin</var>:</p>
8683186872

8683286873
<ol>
86833-
<li><p>If <var>A</var> is "<code data-x="coop-unsafe-none">unsafe-none</code>" and <var>B</var>
86834-
is "<code data-x="coop-unsafe-none">unsafe-none</code>", then return true.</p></li>
86874+
<li><p>If <var>documentCOOP</var> is "<code data-x="coop-unsafe-none">unsafe-none</code>" and
86875+
<var>responseCOOP</var> is "<code data-x="coop-unsafe-none">unsafe-none</code>", then return
86876+
true.</p></li>
8683586877

86836-
<li><p>If <var>A</var> is "<code data-x="coop-unsafe-none">unsafe-none</code>" or <var>B</var>
86837-
is "<code data-x="coop-unsafe-none">unsafe-none</code>", then return false.</p></li>
86878+
<li><p>If <var>documentCOOP</var> is "<code data-x="coop-unsafe-none">unsafe-none</code>" or
86879+
<var>responseCOOP</var> is "<code data-x="coop-unsafe-none">unsafe-none</code>", then return
86880+
false.</p></li>
8683886881

86839-
<li><p>If <var>A</var> is <var>B</var> and <var>originA</var> is <span>same origin</span> with
86840-
<var>originB</var>, then return true.</p></li>
86882+
<li><p>If <var>documentCOOP</var> is <var>responseCOOP</var> and <var>documentOrigin</var> is
86883+
<span>same origin</span> with <var>responseOrigin</var>, then return true.</p></li>
8684186884

8684286885
<li><p>Return false.</p></li>
8684386886
</ol>
@@ -86911,6 +86954,11 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8691186954
<var>policy</var>'s <span data-x="coop-struct-value">value</span> to "<code
8691286955
data-x="coop-same-origin-allow-popups">same-origin-allow-popups</code>".</p></li>
8691386956

86957+
<li><p>If <var>parsedItem</var>[0] is "<code
86958+
data-x="coop-noopener-allow-popups">noopener-allow-popups</code>", then set
86959+
<var>policy</var>'s <span data-x="coop-struct-value">value</span> to "<code
86960+
data-x="coop-noopener-allow-popups">noopener-allow-popups</code>".</p></li>
86961+
8691486962
<li><p>If <var>parsedItem</var>[1]["<code data-x="coop-report-to">report-to</code>"] <span
8691586963
data-x="map exists">exists</span> and it is a string, then set <var>policy</var>'s <span
8691686964
data-x="coop-struct-report-endpoint">reporting endpoint</span> to
@@ -86974,25 +87022,22 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8697487022
<h5 id="browsing-context-group-switches-due-to-cross-origin-opener-policy">Browsing context group
8697587023
switches due to opener policy</h5>
8697687024

86977-
<p>To <dfn data-x="check-browsing-context-group-switch-coop-value">check if COOP values require a
86978-
browsing context group switch</dfn>, given a boolean <var>isInitialAboutBlank</var>, two <span
87025+
<p>To <dfn data-x="check-browsing-context-group-switch-coop-value-popup">check if popup COOP
87026+
values require a browsing context group switch</dfn>, given two <span
8697987027
data-x="origin">origins</span> <var>responseOrigin</var> and
8698087028
<var>activeDocumentNavigationOrigin</var>, and two <span data-x="coop-struct-value">opener policy
8698187029
values</span> <var>responseCOOPValue</var> and <var>activeDocumentCOOPValue</var>:</p>
86982-
8698387030
<ol>
86984-
<li><p>If the result of <span data-x="matching-coop">matching</span>
86985-
<var>activeDocumentCOOPValue</var>, <var>activeDocumentNavigationOrigin</var>,
86986-
<var>responseCOOPValue</var>, and <var>responseOrigin</var> is true, return false.</p></li>
87031+
<li><p><var>responseCOOPValue</var> is "<code
87032+
data-x="coop-noopener-allow-popups">noopener-allow-popups</code>", then return true.</p></li>
8698787033

8698887034
<li>
8698987035
<p>If all of the following are true:</p>
8699087036

8699187037
<ul>
86992-
<li><p><var>isInitialAboutBlank</var>;</p></li>
86993-
8699487038
<li><p><var>activeDocumentCOOPValue</var>'s <span data-x="coop-struct-value">value</span> is
86995-
"<code data-x="coop-same-origin-allow-popups">same-origin-allow-popups</code>"; and</p></li>
87039+
"<code data-x="coop-same-origin-allow-popups">same-origin-allow-popups</code>" or
87040+
"<code data-x="coop-noopener-allow-popups">noopener-allow-popups</code>"; and</p></li>
8699687041

8699787042
<li><p><var>responseCOOPValue</var> is "<code
8699887043
data-x="coop-unsafe-none">unsafe-none</code>",</p></li>
@@ -87001,6 +87046,34 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8700187046
<p>then return false.</p>
8700287047
</li>
8700387048

87049+
<li><p>If the result of <span data-x="matching-coop">matching</span>
87050+
<var>activeDocumentCOOPValue</var>, <var>activeDocumentNavigationOrigin</var>,
87051+
<var>responseCOOPValue</var>, and <var>responseOrigin</var> is true, then return false.</p></li>
87052+
87053+
<li><p>Return true.</p>
87054+
</ol>
87055+
87056+
<p>To <dfn data-x="check-browsing-context-group-switch-coop-value">check if COOP values require a
87057+
browsing context group switch</dfn>, given a boolean <var>isInitialAboutBlank</var>, two <span
87058+
data-x="origin">origins</span> <var>responseOrigin</var> and
87059+
<var>activeDocumentNavigationOrigin</var>, and two <span data-x="coop-struct-value">opener policy
87060+
values</span> <var>responseCOOPValue</var> and <var>activeDocumentCOOPValue</var>:</p>
87061+
87062+
<ol>
87063+
<li><p>If <var>isInitialAboutBlank</var> is true, then return the result of <span
87064+
data-x="check-browsing-context-group-switch-coop-value-popup">checking if popup COOP values
87065+
requires a browsing context group switch</span> with <var>responseOrigin</var>,
87066+
<var>activeDocumentNavigationOrigin</var>, <var>responseCOOPValue</var>, and
87067+
<var>activeDocumentCOOPValue</var>.</p></li>
87068+
87069+
<li>
87070+
<p class="note">Here we are dealing with a non-popup navigation.</p>
87071+
87072+
<p>If the result of <span data-x="matching-coop">matching</span>
87073+
<var>activeDocumentCOOPValue</var>, <var>activeDocumentNavigationOrigin</var>,
87074+
<var>responseCOOPValue</var>, and <var>responseOrigin</var> is true, then return false.</p>
87075+
</li>
87076+
8700487077
<li><p>Return true.</p>
8700587078
</ol>
8700687079

@@ -143606,6 +143679,9 @@ INSERT INTERFACES HERE
143606143679
<dt id="refsFETCH">[FETCH]</dt>
143607143680
<dd><cite><a href="https://fetch.spec.whatwg.org/">Fetch</a></cite>, A. van Kesteren. WHATWG.</dd>
143608143681

143682+
<dt id="refsFETCHMETADATA">[FETCH-METADATA]</dt>
143683+
<dd><cite><a href="https://w3c.github.io/webappsec-fetch-metadata/">Fetch Metadata Request Headers</a></cite>, M.West. W3C.</dd>
143684+
143609143685
<dt id="refsFILEAPI">[FILEAPI]</dt>
143610143686
<dd><cite><a href="https://w3c.github.io/FileAPI/">File API</a></cite>, A. Ranganathan. W3C.</dd>
143611143687

0 commit comments

Comments
 (0)