Skip to content

Commit a338c48

Browse files
VergeAsadym-chromium
authored andcommitted
Disable WebRTC RTCPeerConnection in fenced frames.
WebRTC is one form of network communication that should be disabled when window.fence.disableUntrustedNetwork is called in a fenced frame. However, 1. We don't have any identified use cases for WebRTC in fenced frames 2. The revocation process would be more involved than other forms of network access, which would provide little benefit per #1. 3. Entirely disabling WebRTC PeerConnection instead is beneficial for privacy and does not break existing fenced frame use cases. This CL disables RTCPeerConnection construction entirely in fenced frames, regardless of whether window.fence.disableUntrustedNetwork was called or not. The change is behind an existing flag so that it does not ship until other forms of network revocation do. Disabling RTCPeerConnection *can* be handled entirely by the renderer, but a compromised renderer could potentially circumvent this to construct a peer connection anyway. A follow-up CL will add a browser-side control to ensure that this does not occur. Change-Id: Iaa2caaddeee70852179332dd89c5dbbac3ffcfbf Bug: 41488151 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5527514 Reviewed-by: Guido Urdaneta <[email protected]> Commit-Queue: Andrew Verge <[email protected]> Reviewed-by: Liam Brady <[email protected]> Reviewed-by: Shivani Sharma <[email protected]> Cr-Commit-Position: refs/heads/main@{#1319162}
1 parent 527a815 commit a338c48

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<script src="/resources/testharness.js"></script>
3+
<script src="/resources/testharnessreport.js"></script>
4+
<script src="/common/utils.js"></script>
5+
<script src="/common/dispatcher/dispatcher.js"></script>
6+
<script src="/common/get-host-info.sub.js"></script>
7+
<script src="resources/utils.js"></script>
8+
<title>Test that RTCPeerConnection construction fails in a fenced frame.</title>
9+
10+
<body>
11+
<script>
12+
promise_test(async (t) => {
13+
let fencedframe = attachFencedFrameContext();
14+
return fencedframe.execute(() => {
15+
try {
16+
// Copied from https://webrtc.org/getting-started/peer-connections.
17+
// The contents of the configuration object doesn't matter here,
18+
// because construction should fail before the information becomes
19+
// relevant.
20+
const configuration = {
21+
'iceServers': [{'urls': 'stun:stun.example.com:19302'}]
22+
};
23+
const peerConnection = new RTCPeerConnection(configuration);
24+
assert_unreached("RTCPeerConnection construction should fail in a " +
25+
"fenced frame");
26+
} catch (err) {
27+
assert_equals(err.name, "NotAllowedError");
28+
}
29+
});
30+
}, "Test that RTCPeerConnection construction fails in a fenced frame.");
31+
32+
</script>
33+
</body>

0 commit comments

Comments
 (0)