Skip to content

Commit dbdc4bd

Browse files
Block external protocol handler with sandboxed iframes
Closes #2191.
1 parent a8be76c commit dbdc4bd

File tree

1 file changed

+54
-20
lines changed

1 file changed

+54
-20
lines changed

source

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86739,8 +86739,8 @@ interface <dfn interface>Location</dfn> { // but see also <a href="#the-location
8673986739
is neither "<code data-x="javascript protocol">javascript</code>" nor a <span>fetch
8674086740
scheme</span></dt>
8674186741
<dd><p>Run <span>process a navigate URL scheme</span> given <var>resource</var>'s <span
86742-
data-x="concept-request-url">URL</span>, <var>browsingContext</var>, and
86743-
<var>hasTransientActivation</var>.</p></dd>
86742+
data-x="concept-request-url">URL</span>, <var>browsingContext</var>, <var>sandboxFlags</var>,
86743+
and <var>hasTransientActivation</var>.</p></dd>
8674486744
</dl>
8674586745
</li>
8674686746
</ol>
@@ -87012,8 +87012,8 @@ interface <dfn interface>Location</dfn> { // but see also <a href="#the-location
8701287012
error</span>.</p></li>
8701387013

8701487014
<li><p>Otherwise, if <var>locationURL</var> is a <span>URL</span>, then <span>process a navigate
87015-
URL scheme</span> given <var>locationURL</var>, <var>browsingContext</var>, and
87016-
<var>hasTransientActivation</var>, and return.</p></li>
87015+
URL scheme</span> given <var>locationURL</var>, <var>browsingContext</var>,
87016+
<var>sandboxFlags</var>, and <var>hasTransientActivation</var>, and return.</p></li>
8701787017

8701887018
<li><p>Let <var>responsePolicyContainer</var> be the result of <span>creating a policy container
8701987019
from a fetch response</span> given <var>response</var> and <var>request</var>'s <span
@@ -87222,22 +87222,24 @@ interface <dfn interface>Location</dfn> { // but see also <a href="#the-location
8722287222
<li><p>Otherwise, the document's <var>type</var> is such that the resource will not affect
8722387223
<var>browsingContext</var>, e.g., because the resource is to be handed to an external application
8722487224
or because it is an unknown type that will be processed <span>as a download</span>.
87225-
<span>Hand-off to external software</span> given <var>response</var> and
87226-
<var>hasTransientActivation</var>.</p></li>
87225+
<span>Hand-off to external software</span> given <var>response</var>, <var>browsingContext</var>,
87226+
<var>navigationParams</var>'s <span data-x="navigation-params-sandboxing">final sandboxing flag
87227+
set</span>, and <var>hasTransientActivation</var>.</p></li>
8722787228

8722887229
<!-- It's unclear what integration points with external spces should exist for the last two cases.
8722987230
Maybe it's enough to handle them as downloads? -->
8723087231
</ol>
8723187232

8723287233
<p>To <dfn>process a navigate URL scheme</dfn>, given a <span>URL</span> <var>url</var>, a
87233-
<span>browsing context</span> <var>browsingContext</var>, and a boolean
87234-
<var>hasTransientActivation</var>:</p>
87234+
<span>browsing context</span> <var>browsingContext</var>, a <span>sandboxing flag set</span>
87235+
<var>sandboxFlags</var>, and a boolean <var>hasTransientActivation</var>:</p>
8723587236

8723687237
<ol>
8723787238
<li><p>If <var>url</var> is to be handled using a mechanism that does not affect
8723887239
<var>browsingContext</var>, e.g., because <var>url</var>'s <span
8723987240
data-x="concept-url-scheme">scheme</span> is handled externally, then <span>hand-off to external
87240-
software</span> given <var>url</var> and <var>hasTransientActivation</var>.</p></li>
87241+
software</span> given <var>url</var>, <var>browsingContext</var>, <var>sandboxFlags</var>, and
87242+
<var>hasTransientActivation</var>.</p></li>
8724187243

8724287244
<li>
8724387245
<p>Otherwise, <var>url</var> is to be handled by displaying some sort of inline content, e.g.,
@@ -87252,17 +87254,48 @@ interface <dfn interface>Location</dfn> { // but see also <a href="#the-location
8725287254
</ol>
8725387255

8725487256
<p>To <dfn>hand-off to external software</dfn> given a <span>URL</span> or <span
87255-
data-x="concept-response">response</span> <var>resource</var> and a boolean
87256-
<var>hasTransientActivation</var>, user agents should perform the appropriate handoff of
87257-
<var>resource</var> while attempting to mitigate the risk that this is an attempt to exploit the
87258-
target software. For example, user agents could prompt the user to confirm that the <span>source
87259-
browsing context</span>'s <span>active document</span>'s <span
87260-
data-x="concept-document-origin">origin</span> is to be allowed to invoke the external software in
87261-
question. In particular, if <var>hasTransientActivation</var> is false, then the user agent should
87262-
not invoke the external software package without prior user confirmation.</p>
87263-
87264-
<p class="example">For example, there could be a vulnerability in the target software's URL
87265-
handler which a hostile page would attempt to exploit by tricking a user into clicking a link.</p>
87257+
data-x="concept-response">response</span> <var>resource</var>, a <span>browsing context</span>
87258+
<var>browsingContext</var>, a <span>sandboxing flag set</span> <var>sandboxFlags</var>, and a
87259+
boolean <var>hasTransientActivation</var>, user agents should:</p>
87260+
87261+
<ol>
87262+
<li>
87263+
<p>If <var>browsingContext</var> is not a <span>top-level browsing context</span>, and none
87264+
of:</p>
87265+
87266+
<ul>
87267+
<li><p><var>sandboxFlags</var> contains the <code
87268+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code>
87269+
token and <var>hasTransientActivation</var> is true</p></li>
87270+
87271+
<li><p><var>sandboxFlags</var> contains the <code
87272+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code> token</p></li>
87273+
87274+
<li><p><var>sandboxFlags</var> contains the <code
87275+
data-x="attr-iframe-sandbox-allow-popups">allow-popups</code> token</p></li>
87276+
</ul>
87277+
87278+
<p>hold, then return without invoking the external software package.</p>
87279+
87280+
<p class="note">Navigation inside an iframe toward external software can be seen by users as a
87281+
new popup or a new top-level navigation. Therefore, we enforcing sandbox flags
87282+
appropriately.</p>
87283+
</li>
87284+
87285+
<li>
87286+
<p>Perform the appropriate handoff of <var>resource</var> while attempting to mitigate the risk
87287+
that this is an attempt to exploit the target software. For example, user agents could prompt
87288+
the user to confirm that the <span>source browsing context</span>'s <span>active
87289+
document</span>'s <span data-x="concept-document-origin">origin</span> is to be allowed to
87290+
invoke the external software in question. In particular, if <var>hasTransientActivation</var> is
87291+
false, then the user agent should not invoke the external software package without prior user
87292+
confirmation.</p>
87293+
87294+
<p class="example">For example, there could be a vulnerability in the target software's URL
87295+
handler which a hostile page would attempt to exploit by tricking a user into clicking a
87296+
link.</p>
87297+
</li>
87298+
</ol>
8726687299

8726787300
<p>To <dfn data-x="javascript protocol">execute a <code>javascript:</code> URL request</dfn>,
8726887301
given a <span data-x="concept-request">request</span> <var>request</var>, a <span>browsing
@@ -126429,6 +126462,7 @@ INSERT INTERFACES HERE
126429126462
Arne Thomassen,
126430126463
Aron Spohr,
126431126464
Arphen Lin,
126465+
Arthur Sonzogni, <!-- ArthurSonzogni on GitHub -->
126432126466
Arthur Stolyar,
126433126467
Arun Patole,
126434126468
Aryeh Gregor,

0 commit comments

Comments
 (0)