From 23948ada55777d47f5d30a859f6110bf002338d9 Mon Sep 17 00:00:00 2001 From: Andrew Verge Date: Thu, 7 Nov 2024 21:51:52 +0000 Subject: [PATCH 1/2] Add RTCPeerConnection constructor error to spec. Because WebRTC's RTCPeerConnection interface is disallowed in fenced frames, we need to patch the WebRTC spec to throw an exception in the constructor. This patch also introduces the a "fenced navigable ancestor" algorithm that can be used to determine if a given document is nested in a fenced frame tree. This mechanism is used to trigger the constructor error. --- spec.bs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/spec.bs b/spec.bs index b89be88..606f5ed 100644 --- a/spec.bs +++ b/spec.bs @@ -2474,6 +2474,25 @@ nested traversables in [[HTML]]'s Top-level traversables section. +
+ To get the fenced navigable ancestor of a [=navigable=] |navigable|: + + 1. Let |currentNavigable| be |navigable|. + + 1. While |currentNavigable| is not null: + + 1. If |currentNavigable| is a [=fenced navigable container/fenced navigable=], return + |currentNavigable|. + + 1. Set |currentNavigable| to |currentNavigable|'s [=navigable/parent=]. + + 1. Return |currentNavigable|. + + Note: Some Web Platform algorithms will have additional restrictions if the + [=relevant global object=]'s [=Window/navigable=] has a [=navigable/fenced navigable ancestor=]. + For an example, see the [[#webrtc-monkeypatch]] section below. +
+

Top-level traversables

The [[HTML]] Standard currently defines a [=top-level traversable=] as a [=traversable navigable=] @@ -3918,6 +3937,24 @@ at the expense of some utility. +

WebRTC

+ +The [[WEBRTC]] specification defines "ECMAScript APIs in WebIDL to allow media and generic +application data to be sent to and received from another browser or device implementing the +appropriate set of real-time protocols." The interface which facilitates connections to peers +is {{RTCPeerConnection}}. Construction of this interface, and therefore connection to peers +via WebRTC, is disallowed in fenced frames. + +
+ Modify the {{RTCPeerConnection}} {{RTCPeerConnection/constructor}} algorithm to add new first and + second steps that read: + + 1. Let |navigable| be [=this=]'s [=relevant global object=]'s [=Window/navigable=]. + + 1. If |navigable| has a [=navigable/fenced navigable ancestor=], throw a {{NotAllowedError}} + {{DOMException}}. +
+

Security & Privacy Considerations

This material is being upstreamed from our explainer into this specification, and in the meantime From b6479f9c1a5f02e3035da0fa51dd1aac5c53ea80 Mon Sep 17 00:00:00 2001 From: Andrew Verge Date: Fri, 8 Nov 2024 21:03:33 +0000 Subject: [PATCH 2/2] Address comments from lbrady --- spec.bs | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/spec.bs b/spec.bs index 606f5ed..8dc9a62 100644 --- a/spec.bs +++ b/spec.bs @@ -2474,25 +2474,6 @@ nested traversables in [[HTML]]'s Top-level traversables section. -
- To get the fenced navigable ancestor of a [=navigable=] |navigable|: - - 1. Let |currentNavigable| be |navigable|. - - 1. While |currentNavigable| is not null: - - 1. If |currentNavigable| is a [=fenced navigable container/fenced navigable=], return - |currentNavigable|. - - 1. Set |currentNavigable| to |currentNavigable|'s [=navigable/parent=]. - - 1. Return |currentNavigable|. - - Note: Some Web Platform algorithms will have additional restrictions if the - [=relevant global object=]'s [=Window/navigable=] has a [=navigable/fenced navigable ancestor=]. - For an example, see the [[#webrtc-monkeypatch]] section below. -
-

Top-level traversables

The [[HTML]] Standard currently defines a [=top-level traversable=] as a [=traversable navigable=] @@ -3939,11 +3920,11 @@ at the expense of some utility.

WebRTC

-The [[WEBRTC]] specification defines "ECMAScript APIs in WebIDL to allow media and generic -application data to be sent to and received from another browser or device implementing the -appropriate set of real-time protocols." The interface which facilitates connections to peers -is {{RTCPeerConnection}}. Construction of this interface, and therefore connection to peers -via WebRTC, is disallowed in fenced frames. +The [[WEBRTC]] specification defines "ECMAScript APIs in WebIDL to allow media and generic +application data to be sent to and received from another browser or device implementing the +appropriate set of real-time protocols." The interface which facilitates connections to peers is +{{RTCPeerConnection}}. Construction of this interface, and therefore connection to peers via +WebRTC, is disallowed in fenced frames.
Modify the {{RTCPeerConnection}} {{RTCPeerConnection/constructor}} algorithm to add new first and @@ -3951,8 +3932,8 @@ via WebRTC, is disallowed in fenced frames. 1. Let |navigable| be [=this=]'s [=relevant global object=]'s [=Window/navigable=]. - 1. If |navigable| has a [=navigable/fenced navigable ancestor=], throw a {{NotAllowedError}} - {{DOMException}}. + 1. If |navigable|'s [=traversable navigable=] is a [=fenced navigable container/fenced + navigable=], throw a {{NotAllowedError}} {{DOMException}}.

Security & Privacy Considerations