tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

sdes-dont-dont-dont.html (1468B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <meta name="timeout" content="long">
      4 <title>RTCPeerConnection MUST NOT support SDES</title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="../RTCPeerConnection-helper.js"></script>
      8 <script src="/webrtc/third_party/sdp/sdp.js"></script>
      9 <script>
     10 'use strict';
     11 
     12 // Test support for
     13 // https://www.rfc-editor.org/rfc/rfc8826#section-4.3.1
     14 
     15 const sdp = `v=0
     16 o=- 0 3 IN IP4 127.0.0.1
     17 s=-
     18 t=0 0
     19 m=video 9 UDP/TLS/RTP/SAVPF 100
     20 c=IN IP4 0.0.0.0
     21 a=rtcp-mux
     22 a=sendonly
     23 a=mid:video
     24 a=rtpmap:100 VP8/90000
     25 a=fmtp:100 max-fr=30;max-fs=3600
     26 a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline:2nra27hTUb9ilyn2rEkBEQN9WOFts26F/jvofasw
     27 a=ice-ufrag:ETEn
     28 a=ice-pwd:OtSK0WpNtpUjkY4+86js7Z/l
     29 `;
     30 
     31 // Negative test for Chrome legacy behavior.
     32 promise_test(async t => {
     33  const sdes_constraint = {'mandatory': {'DtlsSrtpKeyAgreement': false}};
     34  const pc = new RTCPeerConnection(null, sdes_constraint);
     35  t.add_cleanup(() => pc.close());
     36 
     37  pc.addTransceiver('audio');
     38  const offer = await pc.createOffer();
     39  assert_false(offer.sdp.includes('\na=crypto:'));
     40 }, 'Does not create offers with SDES');
     41 
     42 promise_test(t => {
     43  const pc = new RTCPeerConnection();
     44  t.add_cleanup(() => pc.close());
     45 
     46  return promise_rejects_dom(t, 'InvalidAccessError',
     47      pc.setRemoteDescription({type: 'offer', sdp}));
     48 }, 'rejects a remote offer that only includes SDES and no DTLS fingerprint');
     49 </script>