Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a CSP check to RTCPeerConnection.addIceCandidate(). #81

Merged
merged 14 commits into from
Jun 15, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ <h3>
<p>
The {{RTCPeerConnection}}
interface is defined in [[WEBRTC]]. This document extends that interface
by adding an additional static method.
by adding an additional static method, and adding a Content-Security-Policy
zenhack marked this conversation as resolved.
Show resolved Hide resolved
check to the constructor.
</p>
<pre class="idl">partial interface RTCPeerConnection {
static sequence&lt;RTCIceServer&gt; getDefaultIceServers();
Expand Down Expand Up @@ -139,6 +140,19 @@ <h2>Methods</h2>
</dd>
</dl>
</section>
<section>
<h2>Modifications to existing procedures</h2>

<p>Whenever the <a data-cite="WEBRTC#dom-peerconnection">RTCPeerConnection constructor</a>
algorithm is invoked, run the following steps instead:
<ol>
<li>If [[WEBAPPSEC-CSP#should-block-rtc-connection]] on the current global object returns "Blocked",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query: the constructor steps have a [[DocumentOrigin]] initialized to the relevant settings object's origin. Is "the relevant settings object" the same as "the current global object", or are they different? And if they're different, is this intentional?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the context of a constructor this's relevant ... and current ... are identical, though a settings object is different from a global object. https://html.spec.whatwg.org/multipage/webappapis.html#realms-settings-objects-global-objects has a longer explanation on this. Sticking with one pattern is better though, I'd recommend sticking with this's relevant ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should-block-rtc-connection says it takes a global object, and it ends up passing that through to create-violation-for-global, so it seems like passing in a settings object is conceptually a type error here, and changing it on the other end would be fairly invasive. But I'm still a little fuzzy on how all these relate, so it's possible I'm missing something.

throw a {{NotAllowedError}}."</li>
zenhack marked this conversation as resolved.
Show resolved Hide resolved
<li>Return the result of running the original
<a data-cite="WEBRTC#dom-peerconnection">RTCPeerConnection constructor</a> algorithm.</li>
zenhack marked this conversation as resolved.
Show resolved Hide resolved
</ol>
</p>
</section>
</section>
<section id="rtcrtptransceiver-interface">
<h3>
Expand Down