<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent" [
<!ENTITY RFC2119 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC2818 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2818.xml">
<!ENTITY RFC3261 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3261.xml">
<!ENTITY RFC3264 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3264.xml">
<!ENTITY RFC3711 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3711.xml">
<!ENTITY RFC3986 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3986.xml">
<!ENTITY RFC4566 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4566.xml">
<!ENTITY RFC4568 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4568.xml">
<!ENTITY RFC4648 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4648.xml">
<!ENTITY RFC8446 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml">
<!ENTITY RFC5479 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5479.xml">
<!ENTITY RFC5705 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5705.xml">
<!ENTITY RFC5763 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5763.xml">
<!ENTITY RFC5764 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5764.xml">
<!ENTITY RFC5785 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5785.xml">
<!ENTITY RFC5890 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5890.xml">
<!ENTITY RFC6265 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6265.xml">
<!ENTITY RFC6347 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6347.xml">
<!ENTITY RFC6454 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6454.xml">
<!ENTITY RFC6455 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6455.xml">
<!ENTITY RFC6943 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6943.xml">
<!ENTITY RFC7022 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7022.xml">
<!ENTITY RFC6120 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6120.xml">
<!ENTITY RFC7617 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7617.xml">
<!ENTITY RFC7675 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7675.xml">
<!ENTITY RFC7918 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7918.xml">
<!ENTITY RFC8174 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC8122 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8122.xml">
<!ENTITY RFC8259 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8259.xml">
<!ENTITY RFC8261 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8261.xml">
<!ENTITY RFC8445 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8445.xml">
]>

<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="std" number="9999"
     ipr="pre5378Trust200902" obsoletes="" updates="" submissionType="IETF" consensus="true" xml:lang="en" tocInclude="true" symRefs="true" sortRefs="true" version="3">

  <front>
    <title abbrev="WebRTC Sec. Arch.">WebRTC Security Architecture</title>

 <seriesInfo name="RFC" value="9999"/>

    <author fullname="Eric Rescorla" initials="E.K." surname="Rescorla">
      <organization>RTFM, Inc.</organization>
      <address>
        <postal>
          <street>2064 Edgewood Drive</street>
          <city>Palo Alto</city>
          <region>CA</region>
          <code>94303</code>
          <country>USA</country>
        </postal>
        <phone>+1 650 678 2350</phone>
        <email>ekr@rtfm.com</email>
      </address>
    </author>

    <date month="August" year="2019"/>

    <abstract>
      <t>
        This document defines the security architecture for WebRTC, a protocol
        suite intended for use with real-time applications that can be deployed
        in browsers - "real time communication on the Web".
      </t>
    </abstract>
  </front>
  <middle>
    <section anchor="sec.introduction" numbered="true" toc="default">
      <name>Introduction</name>
      <t>
        The Real-Time Communications on the Web (RTCWEB) working group
        standardized protocols for real-time communications between Web
        browsers, generally called "WebRTC" <xref target="RFC9995" format="default"/>.
        The major use cases for WebRTC technology are real-time audio
        and/or video calls, Web conferencing, and direct data transfer. Unlike
        most conventional real-time systems, (e.g., SIP-based <xref target="RFC3261" format="default"/> soft phones) WebRTC communications are directly
        controlled by some Web server, via a JavaScript (JS) API as shown in
        <xref target="fig.simple" format="default"/>.
      </t>
      <figure anchor="fig.simple">
        <name>A simple WebRTC system</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[
                            +----------------+
                            |                |
                            |   Web Server   |
                            |                |
                            +----------------+
                                ^        ^
                               /          \
                       HTTP   /            \   HTTP
                             /              \
                            /                \
                           v                  v
                        JS API              JS API
                  +-----------+            +-----------+
                  |           |    Media   |           |
                  |  Browser  |<---------->|  Browser  |
                  |           |            |           |
                  +-----------+            +-----------+
]]></artwork>
      </figure>
      <t>
        A more complicated system might allow for interdomain calling, as shown
        in <xref target="fig.multidomain" format="default"/>.  The protocol to be used between
        the domains is not standardized by WebRTC, but given the installed base
        and the form of the WebRTC API is likely to be something SDP-based like
        SIP or something like Extensible Messaging and Presence Protocol (XMPP)
        <xref target="RFC6120" format="default"/>.
      </t>
      <figure anchor="fig.multidomain">
        <name>A multidomain WebRTC system</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[
                 +--------------+             +--------------+
                 |              | SIP,XMPP,...|              |
                 |  Web Server  |<----------->|  Web Server  |
                 |              |             |              |
                 +--------------+             +--------------+
                        ^                             ^
                        |                             |
                  HTTP  |                             |  HTTP
                        |                             |
                        v                             v
                        JS API                    JS API
                  +-----------+                  +-----------+
                  |           |        Media     |           |
                  |  Browser  |<---------------->|  Browser  |
                  |           |                  |           |
                  +-----------+                  +-----------+
]]></artwork>
      </figure>
      <t>
        This system presents a number of new security challenges, which are
        analyzed in <xref target="RFC9998" format="default"/>.  This document
        describes a security architecture for WebRTC which addresses the threats
        and requirements described in that document.
      </t>
    </section>
    <section anchor="sec-term" numbered="true" toc="default">
      <name>Terminology</name>

    <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST&nbsp;NOT</bcp14>",
    "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>",
    "<bcp14>SHALL&nbsp;NOT</bcp14>", "<bcp14>SHOULD</bcp14>",
    "<bcp14>SHOULD&nbsp;NOT</bcp14>",
    "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT&nbsp;RECOMMENDED</bcp14>",
    "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are
    to be interpreted as described in BCP&nbsp;14 <xref target="RFC2119"/>
    <xref target="RFC8174"/> when, and only when, they appear in all capitals,
    as shown here.</t>

    </section>
    <section anchor="sec.proposal.trusthierarchy" numbered="true" toc="default">
      <name>Trust Model</name>
      <t>
        The basic assumption of this architecture is that network resources
        exist in a hierarchy of trust, rooted in the browser, which serves as
        the user's Trusted Computing Base (TCB). Any security property which the
        user wishes to have enforced must be ultimately guaranteed by the
        browser (or transitively by some property the browser
        verifies). Conversely, if the browser is compromised, then no security
        guarantees are possible.  Note that there are cases (e.g., Internet
        kiosks) where the user can't really trust the browser that much. In
        these cases, the level of security provided is limited by how much they
        trust the browser.
      </t>
      <t>
        Optimally, we would not rely on trust in any entities other than the
        browser. However, this is unfortunately not possible if we wish to have
        a functional system.  Other network elements fall into two categories:
        those which can be authenticated by the browser and thus can be granted
        permissions to access sensitive resources, and those which cannot be
        authenticated and thus are untrusted.
      </t>
      <section anchor="sec.proposal.authenticated" numbered="true" toc="default">
        <name>Authenticated Entities</name>
        <t>
          There are two major classes of authenticated entities in the system:
        </t>
        <ul spacing="normal">
          <li>
              Calling services: Web sites whose origin we can verify (optimally
              via HTTPS, but in some cases because we are on a topologically
              restricted network, such as behind a firewall, and can infer
              authentication from firewall behavior).
            </li>
          <li>
              Other users: WebRTC peers whose origin we can verify
              cryptographically (optimally via DTLS-SRTP).
            </li>
        </ul>
        <t>
          Note that merely being authenticated does not make these entities
          trusted. For instance, just because we can verify that
          https://www.example.org/ is owned by Dr. Evil does not mean that we can
          trust Dr. Evil to access our camera and microphone. However, it gives
          the user an opportunity to determine whether he wishes to trust
          Dr. Evil or not; after all, if he desires to contact Dr. Evil (perhaps
          to arrange for ransom payment), it's safe to temporarily give him
          access to the camera and microphone for the purpose of the call, but
          he doesn't want Dr. Evil to be able to access his camera and
          microphone other than during the call. The point here is that we must
          first identify other elements before we can determine whether and how
          much to trust them. Additionally, sometimes we need to identify the
          communicating peer before we know what policies to apply.
        </t>
      </section>
      <section anchor="sec.proposal.unauthenticated" numbered="true" toc="default">
        <name>Unauthenticated Entities</name>
        <t>
          Other than the above entities, we are not generally able to identify
          other network elements, thus we cannot trust them.  This does not mean
          that it is not possible to have any interaction with them, but it
          means that we must assume that they will behave maliciously and design
          a system which is secure even if they do so.
        </t>
      </section>
    </section>
    <!-- Not layered ? -->
    <section anchor="sec.proposal.overview" numbered="true" toc="default">
      <name>Overview</name>
      <!-- TODO: Federated -->
      <t>
        This section describes a typical WebRTC session and shows how the
        various security elements interact and what guarantees are provided to
        the user. The example in this section is a "best case" scenario in which
        we provide the maximal amount of user authentication and media privacy
        with the minimal level of trust in the calling service. Simpler versions
        with lower levels of security are also possible and are noted in the
        text where applicable. It's also important to recognize the tension
        between security (or performance) and privacy. The example shown here is
        aimed towards settings where we are more concerned about secure calling
        than about privacy, but as we shall see, there are settings where one
        might wish to make different tradeoffs--this architecture is still
        compatible with those settings.
      </t>
      <t>
        For the purposes of this example, we assume the topology shown in the
        figures below. This topology is derived from the topology shown in <xref target="fig.simple" format="default"/>, but separates Alice and Bob's identities from the
        process of signaling.  Specifically, Alice and Bob have relationships
        with some Identity Provider (IdP) that supports a protocol (such as
        OpenID Connect) that can be used to demonstrate their identity to
        other parties. For instance, Alice might have an account with a social
        network which she can then use to authenticate to other web sites
        without explicitly having an account with those sites; this is a fairly
        conventional pattern on the Web. <xref target="sec.trust-relationships" format="default"/> provides an overview of Identity
        Providers and the relevant terminology.  Alice and Bob might have
        relationships with different IdPs as well.
      </t>
      <t>
        This separation of identity provision and signaling isn't particularly
        important in "closed world" cases where Alice and Bob are users on the
        same social network and have identities based on that domain (<xref target="fig.proposal.idp" format="default"/>). However, there are important settings where
        that is not the case, such as federation (calls from one domain to
        another; <xref target="fig.proposal-federated.idp" format="default"/>) and calling on
        untrusted sites, such as where two users who have a relationship via a
        given social network want to call each other on another, untrusted,
        site, such as a poker site.
      </t>
      <t>
        Note that the servers themselves are also authenticated by an external
        identity service, the SSL/TLS certificate infrastructure (not shown).
        As is conventional in the Web, all identities are ultimately rooted in
        that system. For instance, when an IdP makes an identity assertion, the
        Relying Party consuming that assertion is able to verify because it is
        able to connect to the IdP via HTTPS.
      </t>
      <figure anchor="fig.proposal.idp">
        <name>A call with IdP-based identity</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[
                            +----------------+
                            |                |
                            |     Signaling  |
                            |     Server     |
                            |                |
                            +----------------+
                                ^        ^
                               /          \
                       HTTPS  /            \   HTTPS
                             /              \
                            /                \
                           v                  v
                        JS API              JS API
                  +-----------+            +-----------+
                  |           |    Media   |           |
            Alice |  Browser  |<---------->|  Browser  | Bob
                  |           | (DTLS+SRTP)|           |
                  +-----------+            +-----------+
                        ^      ^--+     +--^     ^
                        |         |     |        |
                        v         |     |        v
                  +-----------+   |     |  +-----------+
                  |           |<--------+  |           |
                  |   IdP1    |   |        |    IdP2   |
                  |           |   +------->|           |
                  +-----------+            +-----------+
]]></artwork>
      </figure>
      <t>
        <xref target="fig.proposal-federated.idp" format="default"/> shows essentially the same
        calling scenario but with a call between two separate domains (i.e., a
        federated case), as in <xref target="fig.multidomain" format="default"/>. As mentioned
        above, the domains communicate by some unspecified protocol and
        providing separate signaling and identity allows for calls to be
        authenticated regardless of the details of the inter-domain protocol.
      </t>
      <figure anchor="fig.proposal-federated.idp">
        <name>A federated call with IdP-based identity</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[
        +----------------+    Unspecified    +----------------+
        |                |      protocol     |                |
        |    Signaling   |<----------------->|    Signaling   |
        |    Server      |  (SIP, XMPP, ...) |    Server      |
        |                |                   |                |
        +----------------+                   +----------------+
                 ^                                   ^
                 |                                   |
           HTTPS |                                   | HTTPS
                 |                                   |
                 |                                   |
                 v                                   v
              JS API                               JS API
        +-----------+                             +-----------+
        |           |             Media           |           |
  Alice |  Browser  |<--------------------------->|  Browser  | Bob
        |           |           DTLS+SRTP         |           |
        +-----------+                             +-----------+
              ^      ^--+                      +--^     ^
              |         |                      |        |
              v         |                      |        v
        +-----------+   |                      |  +-----------+
        |           |<-------------------------+  |           |
        |   IdP1    |   |                         |    IdP2   |
        |           |   +------------------------>|           |
        +-----------+                             +-----------+
]]></artwork>
      </figure>
      <section numbered="true" toc="default">
        <name>Initial Signaling</name>
        <t>
          For simplicity, assume the topology in <xref target="fig.proposal.idp" format="default"/>.  Alice and Bob are both users of a common
          calling service; they both have approved the calling service to make
          calls (we defer the discussion of device access permissions until
          later).  They are both connected to the calling service via HTTPS and
          so know the origin with some level of confidence. They also have
          accounts with some identity provider.  This sort of identity service
          is becoming increasingly common in the Web environment (with technologies
          such as Federated Google Login, Facebook Connect, OAuth,
          OpenID, WebFinger), and is often provided as a side effect service of
          a user's ordinary accounts with some service. In this example, we show
          Alice and Bob using a separate identity service, though the identity
          service may be the same entity as the calling service or there may be
          no identity service at all.
        </t>
        <t>
          Alice is logged onto the calling service and decides to call Bob.  She
          can see from the calling service that he is online and the calling
          service presents a JS UI in the form of a button next to Bob's name
          which says "Call". Alice clicks the button, which initiates a JS
          callback that instantiates a PeerConnection object. This does not
          require a security check: JS from any origin is allowed to get this
          far.
        </t>
        <t>
          Once the PeerConnection is created, the calling service JS needs to
          set up some media. Because this is an audio/video call, it creates a
          MediaStream with two MediaStreamTracks, one connected to an audio
          input and one connected to a video input. At this point the first
          security check is required: untrusted origins are not allowed to
          access the camera and microphone, so the browser prompts Alice for
          permission.
        </t>
        <t>
          In the current W3C API, once some streams have been added, Alice's
          browser + JS generates a signaling message <xref target="RFC9996" format="default"/> containing:
        </t>
        <ul spacing="normal">
          <li>
              Media channel information
            </li>
          <li>
              Interactive Connectivity Establishment (ICE) <xref target="RFC8445" format="default"/> candidates
            </li>
          <li>
              A fingerprint attribute binding the communication to a key pair
              <xref target="RFC5763" format="default"/>. Note that this key may simply be
              ephemerally generated for this call or specific to this domain,
              and Alice may have a large number of such keys.
            </li>
        </ul>
        <t>
          Prior to sending out the signaling message, the PeerConnection code
          contacts the identity service and obtains an assertion binding Alice's
          identity to her fingerprint. The exact details depend on the identity
          service (though as discussed in <xref target="sec.generic.idp" format="default"/>
          PeerConnection can be agnostic to them), but for now it's easiest to
          think of as an OAuth token.  The assertion may bind other
          information to the identity besides the fingerprint, but at minimum it
          needs to bind the fingerprint.
        </t>
        <t>
          This message is sent to the signaling server, e.g., by XMLHttpRequest
          <xref target="XmlHttpRequest" format="default"/> or by WebSockets <xref target="RFC6455" format="default"/>, over TLS <xref target="RFC8446" format="default"/>.
          The signaling server processes the message from Alice's browser,
          determines that this is a call to Bob and sends a signaling message to
          Bob's browser (again, the format is currently undefined).  The JS on
          Bob's browser processes it, and alerts Bob to the incoming call and to
          Alice's identity. In this case, Alice has provided an identity
          assertion and so Bob's browser contacts Alice's identity provider
          (again, this is done in a generic way so the browser has no specific
          knowledge of the IdP) to verify the assertion. It is also possible
          to have IdPs with which the browser has a specific trustrelationship,
          as described in <xref target="sec.trust-relationships" format="default"/>.
          This allows the browser
          to display a trusted element in the browser chrome indicating that a
          call is coming in from Alice. If Alice is in Bob's address book, then
          this interface might also include her real name, a picture, etc.  The
          calling site will also provide some user interface element (e.g., a
          button) to allow Bob to answer the call, though this is most likely
          not part of the trusted UI.
        </t>
        <t>
          If Bob agrees a PeerConnection is instantiated with the message from
          Alice's side.  Then, a similar process occurs as on Alice's browser:
          Bob's browser prompts him for device permission, the media streams are
          created, and a return signaling message containing media information,
          ICE candidates, and a fingerprint is sent back to Alice via the
          signaling service.  If Bob has a relationship with an IdP, the message
          will also come with an identity assertion.
        </t>
        <t>
          At this point, Alice and Bob each know that the other party wants to
          have a secure call with them. Based purely on the interface provided
          by the signaling server, they know that the signaling server claims
          that the call is from Alice to Bob. This level of security is provided
          merely by having the fingerprint in the message and having that
          message received securely from the signaling server.  Because the far
          end sent an identity assertion along with their message, they know
          that this is verifiable from the IdP as well. Note that if the call is
          federated, as shown in <xref target="fig.proposal-federated.idp" format="default"/>
          then Alice is able to verify Bob's identity in a way that is not
          mediated by either her signaling server or Bob's. Rather, she verifies
          it directly with Bob's IdP.
        </t>
        <t>
          Of course, the call works perfectly well if either Alice or Bob
          doesn't have a relationship with an IdP; they just get a lower level
          of assurance. I.e., they simply have whatever information their
          calling site claims about the caller/callee's identity.  Moreover,
          Alice might wish to make an anonymous call through an anonymous
          calling site, in which case she would of course just not provide any
          identity assertion and the calling site would mask her identity from
          Bob.
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>Media Consent Verification</name>
        <t>
          As described in <xref target="RFC9998"
	  sectionFormat="comma" section="4.2"/>, media consent verification is provided via ICE.  Thus, Alice and
          Bob perform ICE checks with each other.  At the completion of these
          checks, they are ready to send non-ICE data.
        </t>
        <t>
          At this point, Alice knows that (a) Bob (assuming he is verified via
          his IdP) or someone else who the signaling service is claiming is Bob
          is willing to exchange traffic with her and (b) that either Bob is at
          the IP address which she has verified via ICE or there is an attacker
          who is on-path to that IP address detouring the traffic. Note that it
          is not possible for an attacker who is on-path between Alice and Bob
          but not attached to the signaling service to spoof these checks
          because they do not have the ICE credentials. Bob has the same
          security guarantees with respect to Alice.
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>DTLS Handshake</name>
        <t>
          Once the requisite ICE checks have completed, Alice and Bob can set
          up a secure channel or channels. This is performed via DTLS <xref target="RFC6347" format="default"/>
          and DTLS-SRTP <xref target="RFC5763" format="default"/> keying for SRTP
          <xref target="RFC3711" format="default"/> for the media channel and SCTP over DTLS
          <xref target="RFC8261" format="default"/> for data
          channels. Specifically, Alice and Bob perform a DTLS handshake on
          every component which has been established by ICE. The total number of
          channels depends on the amount of muxing; in the most likely case we
          are using both RTP/RTCP mux and muxing multiple media streams on the
          same channel, in which case there is only one DTLS handshake. Once the
          DTLS handshake has completed, the keys are exported <xref target="RFC5705" format="default"/> and used to key SRTP for the media channels.
        </t>
        <t>
          At this point, Alice and Bob know that they share a set of secure data
          and/or media channels with keys which are not known to any third-party
          attacker. If Alice and Bob authenticated via their IdPs, then they
          also know that the signaling service is not mounting a
          man-in-the-middle attack on their traffic. Even if they do not use an
          IdP, as long as they have minimal trust in the signaling service not
          to perform a man-in-the-middle attack, they know that their
          communications are secure against the signaling service as well (i.e.,
          that the signaling service cannot mount a passive attack on the
          communications).
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>Communications and Consent Freshness</name>
        <t>
          From a security perspective, everything from here on in is a little
          anticlimactic: Alice and Bob exchange data protected by the keys
          negotiated by DTLS. Because of the security guarantees discussed in
          the previous sections, they know that the communications are encrypted
          and authenticated.
        </t>
        <t>
          The one remaining security property we need to establish is "consent
          freshness", i.e., allowing Alice to verify that Bob is still prepared
          to receive her communications so that Alice does not continue to send
          large traffic volumes to entities which went abruptly offline. ICE
          specifies periodic STUN keepalives but only if media is not flowing.
          Because the consent issue is more difficult here, we require WebRTC
          implementations to periodically send keepalives.
  As described in
          <xref target="sec.proposal.communications.consent"/>, these
	  keepalives <bcp14>MUST</bcp14> be based on the consent freshness
	  mechanism specified in <xref target="RFC7675" format="default"/>.
	  If a keepalive fails and no new ICE channels can be established,
	  then the session is terminated.</t>

<!-- No Section 5.3 in this doc., so changed to 6.3 so could create a
     link. -->

      </section>
    </section>

    <section anchor="sec.sdp-id-attr" numbered="true" toc="default">
      <name>SDP Identity Attribute</name>

      <t>The SDP 'identity' attribute is a session-level attribute that
        is used by an endpoint to convey its identity assertion to its
        peer. The identity assertion value is encoded as Base-64, as described
        in <xref target="RFC4648" sectionFormat="of" section="4"/>.</t>

      <t>The procedures in this section are based on the assumption
        that the identity assertion of an endpoint is bound to the
        fingerprints of the endpoint. This does not preclude the definition of
        alternative means of binding an assertion to the endpoint, but such
        means are outside the scope of this specification.</t>

      <t>The semantics of multiple 'identity' attributes within an
        offer or answer are undefined.  Implementations <bcp14>SHOULD</bcp14>
	only include a single 'identity' attribute in an offer or answer and
	relying parties <bcp14>MAY</bcp14> elect to ignore all but the first
	'identity' attribute.</t>

      <dl newline="false" spacing="normal" indent="3">
        <dt>Name:</dt>
        <dd>identity</dd>
        <dt>Value:</dt>
        <dd>identity-assertion</dd>
        <dt>Usage Level:</dt>
        <dd>session</dd>
        <dt>Charset Dependent:</dt>
        <dd>no</dd>
        <dt>Default Value:</dt>
        <dd>N/A</dd>
        <dt>Name:</dt>
        <dd>identity</dd>
      </dl>

<t>Syntax:</t>

<figure anchor="abnf">
          <name>ABNF</name>
  <sourcecode type="abnf" name="abnf-1"><![CDATA[
  identity-assertion        = identity-assertion-value
                              *(SP identity-extension)
  identity-assertion-value  = base64
  identity-extension        = extension-name [ "=" extension-value ]
  extension-name            = token
  extension-value           = 1*(%x01-09 / %x0b-0c / %x0e-3a / %x3c-ff)
                              ; byte-string from [RFC4566]
]]></sourcecode>
</figure>

<ul>
  <li>ALPHA and DIGIT as defined in <xref target="RFC4566"/></li>
  <li>base64 as defined in <xref target="RFC4566"/></li>
</ul>

<t>Example:</t>

<artwork name="" type="" align="left" alt=""><![CDATA[
    a=identity:\
    eyJpZHAiOnsiZG9tYWluIjoiZXhhbXBsZS5vcmciLCJwcm90b2NvbCI6ImJvZ3Vz\
    In0sImFzc2VydGlvbiI6IntcImlkZW50aXR5XCI6XCJib2JAZXhhbXBsZS5vcmdc\
    IixcImNvbnRlbnRzXCI6XCJhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3l6XCIsXCJz\
    aWduYXR1cmVcIjpcIjAxMDIwMzA0MDUwNlwifSJ9
]]></artwork>

<t>Note that long lines in the example are folded to meet the column
width constraints of this document; the backslash ("\") at the end of
a line, the carriage return that follows, and whitespace shall be ignored.</t>

<t>This specification does not define any extensions for the attribute.</t>

   <t>The identity-assertion value is a JSON <xref target="RFC8259" format="default"/> encoded string. The JSON object
         contains two keys: "assertion" and "idp". The <tt>assertion</tt> key value contains
         an opaque string that is consumed by the IdP. The <tt>idp</tt> key value contains a
         dictionary with one or two further values that identify the IdP. See
    <xref target="sec.request-assert" format="default"/> for more details.</t>

      <section anchor="sec.sdp-id-attr-oa" numbered="true" toc="default">
        <name>Offer/Answer Considerations</name>
        <t>
           This section defines the SDP Offer/Answer <xref target="RFC3264" format="default"/> considerations for the SDP
           'identity' attribute.
        </t>
        <t>
           Within this section, 'initial offer' refers to the first offer in the
           SDP session that contains an SDP <tt>identity</tt> attribute.
        </t>
        <section anchor="sec.sdp-id-attr-oa-inio" numbered="true" toc="default">
          <name>Generating the Initial SDP Offer</name>
          <t>
           When an offerer sends an offer, in order to provide its
           identity assertion to the peer, it includes an 'identity' attribute in
           the offer. In addition, the offerer includes one or more SDP
           'fingerprint' attributes.  The 'identity' attribute <bcp14>MUST</bcp14> be bound to
           all the 'fingerprint' attributes in the session
           description.
          </t>
        </section>
        <section anchor="sec.sdp-id-attr-oa-ansa" numbered="true" toc="default">
          <name>Generating of SDP Answer</name>
          <t>
             If the answerer elects to include an 'identity' attribute, it follows
             the same steps as those in <xref target="sec.sdp-id-attr-oa-inio" format="default"/>.
             The answerer can choose to include or omit an 'identity' attribute independently,
             regardless of whether the offerer did so.
          </t>
        </section>
        <section anchor="sec.sdp-id-attr-oa-offa" numbered="true" toc="default">
          <name>Processing an SDP Offer or Answer</name>
          <t>
             When an endpoint receives an offer or answer that contains an 'identity'
             attribute, the answerer can use the the attribute information to
             contact the IdP and verify the identity of the peer. If the identity
             requires a third-party IdP as described in <xref target="sec.trust-relationships" format="default"/>
             then that IdP will need to have been specifically configured. 
             If the identity verification fails, the answerer <bcp14>MUST</bcp14> discard the
             offer or answer as malformed.
          </t>
        </section>
        <section anchor="sec.sdp-id-attr-oa-modi" numbered="true" toc="default">
          <name>Modifying the Session</name>
          <t>
             When modifying a session, if the set of fingerprints is
             unchanged, then the sender <bcp14>MAY</bcp14> send the same 'identity' attribute. In
             this case, the established identity <bcp14>MUST</bcp14> be applied to existing DTLS
             connections as well as new connections established using one of those
             fingerprints. Note that
 <xref target="RFC9996" sectionFormat="comma" section="5.2.1"/> requires that each media section use the same set of
             fingerprints for every media section.
             If a new identity attribute is received, then the receiver <bcp14>MUST</bcp14>
             apply that identity to all existing connections.
          </t>
          <t>
             If the set of fingerprints changes, then the sender <bcp14>MUST</bcp14>
             either send a new 'identity' attribute or none at all.
             Because a change in fingerprints also causes a new DTLS
             connection to be established, the receiver <bcp14>MUST</bcp14> discard
             all previously established identities.
          </t>
        </section>
      </section>
    </section>
    <section anchor="sec.proposal.detailed" numbered="true" toc="default">
      <name>Detailed Technical Description</name>
      <section anchor="sec.proposal.origin" numbered="true" toc="default">
        <name>Origin and Web Security Issues</name>
        <t>
          The basic unit of permissions for WebRTC is the origin <xref target="RFC6454" format="default"/>. Because the security of the origin depends on
          being able to authenticate content from that origin, the origin can
          only be securely established if data is transferred over HTTPS <xref target="RFC2818" format="default"/>. Thus, clients <bcp14>MUST</bcp14> treat HTTP and HTTPS origins as
          different permissions domains. Note: this follows directly from the
          origin security model and is stated here merely for clarity.
        </t>
        <t>
          Many web browsers currently forbid by default any active mixed content
          on HTTPS pages. That is, when JavaScript is loaded from an HTTP origin
          onto an HTTPS page, an error is displayed and the HTTP content is not
          executed unless the user overrides the error. Any browser which
          enforces such a policy will also not permit access to WebRTC
          functionality from mixed content pages (because they never display
          mixed content).  Browsers which allow active mixed content <bcp14>MUST</bcp14>
          nevertheless disable WebRTC functionality in mixed content settings.
        </t>
        <t>
          Note that it is possible for a page which was not mixed content to
          become mixed content during the duration of the call.  The major risk
          here is that the newly arrived insecure JS might redirect media to a
          location controlled by the attacker.  Implementations <bcp14>MUST</bcp14> either
          choose to terminate the call or display a warning at that point.
        </t>
        <t>
          Also note that the security architecture depends on the keying material
          not being available to move between origins.  But, it is assumed that
          the identity assertion can be passed to anyone that the page cares to.
        </t>
      </section>
      <section anchor="sec.proposal.device.permissions" numbered="true" toc="default">
        <name>Device Permissions Model</name>
        <t>
          Implementations <bcp14>MUST</bcp14> obtain explicit user consent prior to providing
          access to the camera and/or microphone. Implementations <bcp14>MUST</bcp14> at
          minimum support the following two permissions models for HTTPS
          origins.
        </t>
        <ul spacing="normal">
          <li>
              Requests for one-time camera/microphone access.
            </li>
          <li>
              Requests for permanent access.
            </li>
        </ul>
        <t>
          Because HTTP origins cannot be securely established against network
          attackers, implementations <bcp14>MUST</bcp14> refuse all permissions grants for
          HTTP origins.
        </t>
        <t>
          In addition, they <bcp14>SHOULD</bcp14> support requests for access that promise that
          media from this grant will be sent to a single communicating peer
          (obviously there could be other requests for other peers), eE.g.,
          "Call customerservice@example.org".  The semantics of this request are
          that the media stream from the camera and microphone will only be
          routed through a connection which has been cryptographically verified
          (through the IdP mechanism or an X.509 certificate in the DTLS-SRTP
          handshake) as being associated with the stated identity. Note that it
          is unlikely that browsers would have X.509 certificates, but servers
          might.  Browsers servicing such requests <bcp14>SHOULD</bcp14> clearly indicate that
          identity to the user when asking for permission.  The idea behind this
          type of permissions is that a user might have a fairly narrow list of
          peers he is willing to communicate with, e.g., "my mother" rather than
          "anyone on Facebook". Narrow permissions grants allow the browser to
          do that enforcement.
        </t>
        <dl newline="false" spacing="normal" indent="3">
          <dt>API Requirement:</dt>
          <dd>
              The API <bcp14>MUST</bcp14> provide a mechanism for the requesting JS to
              relinquish the ability to see or modify the media (e.g., via
              MediaStream.record()).  Combined with secure authentication of the
              communicating peer, this allows a user to be sure that the calling
              site is not accessing or modifying their conversion.
            </dd>
        </dl>
        <dl newline="false" spacing="normal" indent="3">
          <dt>UI Requirement:</dt>
          <dd>
              The UI <bcp14>MUST</bcp14> clearly indicate when the user's camera and microphone
              are in use.  This indication <bcp14>MUST&nbsp;NOT</bcp14> be suppressable by the JS
              and <bcp14>MUST</bcp14> clearly indicate how to terminate device access, and
              provide a UI means to immediately stop camera/microphone input
              without the JS being able to prevent it.
            </dd>
        </dl>
        <dl newline="false" spacing="normal" indent="3">
          <dt>UI Requirement:</dt>
          <dd>
              If the UI indication of camera/microphone use are displayed in the
              browser such that minimizing the browser window would hide the
              indication, or the JS creating an overlapping window would hide
              the indication, then the browser <bcp14>SHOULD</bcp14> stop camera and microphone
              input when the indication is hidden.  [Note: this may not be
              necessary in systems that are non-windows-based but that have good
              notifications support, such as phones.]
            </dd>
        </dl>
        <ul spacing="normal">
          <li>
              Browsers <bcp14>MUST&nbsp;NOT</bcp14> permit permanent screen or application sharing
              permissions to be installed as a response to a JS request for
              permissions. Instead, they must require some other user action
              such as a permissions setting or an application install experience
              to grant permission to a site.
            </li>
          <li>
              Browsers <bcp14>MUST</bcp14> provide a separate dialog request for
              screen/application sharing permissions even if the media request
              is made at the same time as camera and microphone.
            </li>
          <li>
              The browser <bcp14>MUST</bcp14> indicate any windows which are currently being
              shared in some unambiguous way. Windows which are not visible
	      <bcp14>MUST&nbsp;NOT</bcp14> be shared even if the application is being shared.  If the
              screen is being shared, then that <bcp14>MUST</bcp14> be indicated.
            </li>
        </ul>
        <t>
          Browsers <bcp14>MAY</bcp14> permit the formation of data channels without any direct
          user approval. Because sites can always tunnel data through the
          server, further restrictions on the data channel do not provide any
          additional security.  (See <xref target="sec.proposal.communications.consent" format="default"/> for a related issue).
        </t>
        <t>
          Implementations which support some form of direct user authentication
          <bcp14>SHOULD</bcp14> also provide a policy by which a user can authorize calls only
          to specific communicating peers. Specifically, the implementation
          <bcp14>SHOULD</bcp14> provide the following interfaces/controls:
        </t>
        <ul spacing="normal">
          <li>
              Allow future calls to this verified user.
            </li>
          <li>
              Allow future calls to any verified user who is in my system
              address book (this only works with address book integration, of
              course).
            </li>
        </ul>
        <t>
          Implementations <bcp14>SHOULD</bcp14> also provide a different user interface
          indication when calls are in progress to users whose identities are
          directly verifiable.  <xref target="sec.proposal.comsec" format="default"/> provides
          more on this.
        </t>
      </section>
      <section anchor="sec.proposal.communications.consent" numbered="true" toc="default">
        <name>Communications Consent</name>
        <t>
          Browser client implementations of WebRTC <bcp14>MUST</bcp14> implement ICE.  Server
          gateway implementations which operate only at public IP addresses <bcp14>MUST</bcp14>
          implement either full ICE or ICE-Lite <xref target="RFC8445" format="default"/>.
        </t>
        <t>
          Browser implementations <bcp14>MUST</bcp14> verify reachability via ICE prior to
          sending any non-ICE packets to a given destination.  Implementations
          <bcp14>MUST&nbsp;NOT</bcp14> provide the ICE transaction ID to JavaScript during the
          lifetime of the transaction (i.e., during the period when the ICE
          stack would accept a new response for that transaction).  The JS
          <bcp14>MUST&nbsp;NOT</bcp14> be permitted to control the local ufrag and password, though it of
          course knows it.
        </t>
        <t> <!-- FIXME: phrasing of first sentence still awkward -->
          While continuing consent is required, the ICE
          <xref target="RFC8445" sectionFormat="comma" section="10"/> keepalives use STUN Binding Indications which are
          one-way and therefore not sufficient.  The current WG consensus is to
          use ICE Binding Requests for continuing consent freshness. ICE already
          requires that implementations respond to such requests, so this
          approach is maximally compatible. A separate document will profile the
          ICE timers to be used; see <xref target="RFC7675" format="default"/>.
        </t>
      </section>
      <section anchor="sec.proposal.ip.location.privacy" numbered="true" toc="default">
        <name>IP Location Privacy</name>
        <t>
          A side effect of the default ICE behavior is that the peer learns
          one's IP address, which leaks large amounts of location
          information. This has negative privacy consequences in some
          circumstances. The API requirements in this section are intended to
          mitigate this issue. Note that these requirements are not intended to
          protect the user's IP address from a malicious site. In general, the
          site will learn at least a user's server reflexive address from any
          HTTP transaction.  Rather, these requirements are intended to allow a
          site to cooperate with the user to hide the user's IP address from the
          other side of the call. Hiding the user's IP address from the server
          requires some sort of explicit privacy preserving mechanism on the
          client (e.g., Tor Browser
      <eref target="https://www.torproject.org/projects/torbrowser.html.en"/>) and
          is out of scope for this specification.
        </t>
        <dl newline="false" spacing="normal" indent="3">
          <dt>API Requirement:</dt>
          <dd>
              The API <bcp14>MUST</bcp14> provide a mechanism to allow the JS to suppress ICE
              negotiation (though perhaps to allow candidate gathering) until
              the user has decided to answer the call [note: determining when
              the call has been answered is a question for the JS.]  This
              enables a user to prevent a peer from learning their IP address if
              they elect not to answer a call and also from learning whether the
              user is online.
            </dd>
        </dl>
        <dl newline="false" spacing="normal" indent="3">
          <dt>API Requirement:</dt>
          <dd>
              The API <bcp14>MUST</bcp14> provide a mechanism for the calling application JS to
              indicate that only TURN candidates are to be used. This prevents
              the peer from learning one's IP address at all.  This mechanism
              <bcp14>MUST</bcp14> also permit suppression of the related address field, since
              that leaks local addresses.
            </dd>
        </dl>
        <dl newline="false" spacing="normal" indent="3">
          <dt>API Requirement:</dt>
          <dd>
              The API <bcp14>MUST</bcp14> provide a mechanism for the calling application to
              reconfigure an existing call to add non-TURN candidates.  Taken
              together, this and the previous requirement allow ICE negotiation
              to start immediately on incoming call notification, thus reducing
              post-dial delay, but also to avoid disclosing the user's IP
              address until they have decided to answer. They also allow users
              to completely hide their IP address for the duration of the
              call. Finally, they allow a mechanism for the user to optimize
              performance by reconfiguring to allow non-TURN candidates during
              an active call if the user decides they no longer need to hide
              their IP address
            </dd>
        </dl>
        <t>
          Note that some enterprises may operate proxies and/or NATs designed to
          hide internal IP addresses from the outside world. WebRTC provides no
          explicit mechanism to allow this function. Either such enterprises
          need to proxy the HTTP/HTTPS and modify the SDP and/or the JS, or
          there needs to be browser support to set the "TURN-only" policy
          regardless of the site's preferences.
        </t>
      </section>
      <section anchor="sec.proposal.comsec" numbered="true" toc="default">
        <name>Communications Security</name>
        <t>
          Implementations <bcp14>MUST</bcp14> support SRTP <xref target="RFC3711" format="default"/>.
          Implementations <bcp14>MUST</bcp14> support DTLS <xref target="RFC6347" format="default"/> and
          DTLS-SRTP <xref target="RFC5763" format="default"/> <xref target="RFC5764" format="default"/> for SRTP
          keying. Implementations <bcp14>MUST</bcp14> support SCTP over DTLS <xref target="RFC8261" format="default"/>.
        </t>
        <t>
          All media channels <bcp14>MUST</bcp14> be secured via SRTP and SRTCP.  Media traffic <bcp14>MUST&nbsp;NOT</bcp14>
          be sent over plain (unencrypted) RTP or RTCP; that is,
	  implementations <bcp14>MUST&nbsp;NOT</bcp14> negotiate cipher suites with NULL encryption modes.  DTLS-SRTP
          <bcp14>MUST</bcp14> be offered for every media channel.  WebRTC implementations <bcp14>MUST&nbsp;NOT</bcp14>
          offer SDP Security Descriptions <xref target="RFC4568" format="default"/> or select it if offered.
          A SRTP MKI <bcp14>MUST&nbsp;NOT</bcp14> be used.
        </t>
        <t>
          All data channels <bcp14>MUST</bcp14> be secured via DTLS.
        </t>
        <t>
         All Implementations <bcp14>MUST</bcp14> support DTLS 1.2 with the
          TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 cipher suite and the
          <xref target="FIPS186" format="default">P-256 curve</xref>.
          Earlier drafts of this specification required
          DTLS 1.0 with the cipher suite
          TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, and at the time of this
          writing some implementations do not support DTLS 1.2;
          endpoints which support only DTLS 1.2 might encounter
          interoperability issues.
          The DTLS-SRTP protection profile
          SRTP_AES128_CM_HMAC_SHA1_80 <bcp14>MUST</bcp14> be supported for
          SRTP.
          Implementations
          <bcp14>MUST</bcp14> favor cipher suites which support (Perfect Forward Secrecy) PFS
          over non-PFS cipher suites and <bcp14>SHOULD</bcp14> favor AEAD over non-AEAD cipher suites.
        </t>
        <t>
          Implementations <bcp14>MUST&nbsp;NOT</bcp14> implement DTLS renegotiation and <bcp14>MUST</bcp14> reject
          it with a "no_renegotiation" alert if offered.</t>
        <t>
          Endpoints <bcp14>MUST&nbsp;NOT</bcp14> implement TLS False Start <xref target="RFC7918" format="default"/>.</t>

        <dl newline="false" spacing="normal" indent="3">
          <dt>API Requirement:</dt>
          <dd>
              The API <bcp14>MUST</bcp14> generate a new authentication key pair for every new
              call by default.  This is intended to allow for unlinkability.
            </dd>
          <dt>API Requirement:</dt>
          <dd>
              The API <bcp14>MUST</bcp14> provide a means to reuse a key pair for calls.  This
              can be used to enable key continuity-based authentication, and
              could be used to amortize key generation costs.
            </dd>
          <dt>API Requirement:</dt>
          <dd>
              Unless
              the user specifically configures an external key pair, different
              key pairs <bcp14>MUST</bcp14> be used for each origin. (This avoids creating a
              super-cookie.)
            </dd>
          <dt>API Requirement:</dt>
          <dd>
              When DTLS-SRTP is used, the API <bcp14>MUST&nbsp;NOT</bcp14> permit the JS to obtain
              the negotiated keying material. This requirement preserves the
              end-to-end security of the media.
            </dd>
        </dl>

        <dl newline="false" spacing="normal" indent="3">
          <dt>UI Requirements: </dt>
          <dd>
              A user-oriented client <bcp14>MUST</bcp14> provide an "inspector" interface which
              allows the user to determine the security characteristics of the
              media.
            </dd>
          <dt/>
          <dd>
              The following properties <bcp14>SHOULD</bcp14> be displayed "up-front" in the
              browser chrome, i.e., without requiring the user to ask for them:
            </dd>
          <dt/>
          <dd>
            <ul spacing="normal">
              <li>
                  A client <bcp14>MUST</bcp14> provide a user interface through which a user
                  may determine the security characteristics for
                  currently-displayed audio and video stream(s)
                </li>
              <li>
                  A client <bcp14>MUST</bcp14> provide a user interface through which a user
                  may determine the security characteristics for transmissions
                  of their microphone audio and camera video.
                </li>
              <li>
                  If the far endpoint was directly verified, either via a
                  third-party verifiable X.509 certificate or via a Web IdP
                  mechanism (see <xref target="sec.generic.idp" format="default"/>) the "security
                  characteristics" <bcp14>MUST</bcp14> include the verified information.  X.509
                  identities and Web IdP identities have similar semantics and
                  should be displayed in a similar way.
                </li>
            </ul>
          </dd>
          <dt/>
          <dd>
              The following properties are more likely to require some
              "drill-down" from the user:
            </dd>
          <dt/>
          <dd>
            <ul spacing="normal">
              <li>
                  The "security characteristics" <bcp14>MUST</bcp14> indicate the cryptographic
                  algorithms in use (For example: "AES-CBC".)
                </li>
              <li>
                  The "security characteristics" <bcp14>MUST</bcp14> indicate whether PFS is
                  provided.
                </li>
              <li>
                  The "security characteristics" <bcp14>MUST</bcp14> include some mechanism to
                  allow an out-of-band verification of the peer, such as a
                  certificate fingerprint or a Short Authentication String (SAS).
                  These are compared by the peers to authenticate one another.
                </li>
            </ul>
          </dd>
        </dl>
      </section>
    </section>
    <section anchor="sec.generic.idp" numbered="true" toc="default">
      <name>Web-Based Peer Authentication</name>
      <t>
          In a number of cases, it is desirable for the endpoint (i.e., the
          browser) to be able to directly identify the endpoint on the other
          side without trusting the signaling service to which they are
          connected. For instance, users may be making a call via a federated
          system where they wish to get direct authentication of the other
          side. Alternately, they may be making a call on a site which they
          minimally trust (such as a poker site) but to someone who has an
          identity on a site they do trust (such as a social network.)
      </t>
      <t>
          Recently, a number of Web-based identity technologies (OAuth,
          Facebook Connect etc.) have been developed. While the
          details vary, what these technologies share is that they have a
          Web-based (i.e., HTTP/HTTPS) identity provider which attests to Alice's
          identity. For instance, if Alice has an account at example.org, Alice could
          use the example.org identity provider to prove to others that Alice is
          alice@example.org.  The development of these technologies allows us to
          separate calling from identity provision: Alice could call you on a
          poker site but identify herself as alice@example.org.
      </t>
      <t>
          Whatever the underlying technology, the general principle is that the
          party which is being authenticated is NOT the signaling site but
          rather the user (and their browser). Similarly, the relying party is
          the browser and not the signaling site.  Thus, the browser <bcp14>MUST</bcp14>
          generate the input to the IdP assertion process and
          display the results of the verification process to the user
          in a way which cannot be imitated by the calling site.
      </t>
      <t>
          The mechanisms defined in this document do not require the browser to
          implement any particular identity protocol or to support any
          particular IdP. Instead, this document provides a generic interface
          which any IdP can implement. Thus, new IdPs and protocols can be
          introduced without change to either the browser or the calling
          service. This avoids the need to make a commitment to any particular
          identity protocol, although browsers may opt to directly implement
          some identity protocols in order to provide superior performance or UI
          properties.
      </t>
      <section anchor="sec.trust-relationships" numbered="true" toc="default">
        <name>Trust Relationships: IdPs, APs, and RPs</name>
        <t>
            Any federated identity protocol has three major participants:
        </t>
        <dl newline="false" spacing="normal" indent="3">
          <dt>Authenticating Party (AP):</dt>
          <dd>
                The entity which is trying to establish its identity.
              </dd>
          <dt>Identity Provider (IdP):</dt>
          <dd>
                The entity which is vouching for the AP's identity.
              </dd>
          <dt>Relying Party (RP):</dt>
          <dd>
                The entity which is trying to verify the AP's identity.
              </dd>
        </dl>
        <t>
            The AP and the IdP have an account relationship of some kind: the AP
            registers with the IdP and is able to subsequently authenticate
            directly to the IdP (e.g., with a password). This means that the
            browser must somehow know which IdP(s) the user has an account
            relationship with.  This can either be something that the user
            configures into the browser or that is configured at the calling
            site and then provided to the PeerConnection by the Web application
            at the calling site. The use case for having this information
            configured into the browser is that the user may "log into" the
            browser to bind it to some identity. This is becoming common in new
            browsers. However, it should also be possible for the IdP
            information to simply be provided by the calling application.
        </t>
        <t>
            At a high level there are two kinds of IdPs:
        </t>
        <dl newline="false" spacing="normal" indent="3">
          <dt>Authoritative: </dt>
          <dd>
                IdPs which have verifiable control of some section of the
                identity space. For instance, in the realm of e-mail, the
                operator of "example.com" has complete control of the namespace
                ending in "@example.com". Thus, "alice@example.com" is whoever
                the operator says it is. Examples of systems with authoritative
                identity providers include DNSSEC, RFC 4474, and Facebook
                Connect (Facebook identities only make sense within the context
                of the Facebook system).
              </dd>
          <dt>Third-Party: </dt>
          <dd>
                IdPs which don't have control of their section of the identity
                space but instead verify user's identities via some unspecified
                mechanism and then attest to it. Because the IdP doesn't
                actually control the namespace, RPs need to trust that the IdP
                is correctly verifying AP identities, and there can potentially
                be multiple IdPs attesting to the same section of the identity
                space. Probably the best-known example of a third-party identity
                provider is SSL/TLS certificates, where there are a large number of
                CAs all of whom can attest to any domain name.
              </dd>
        </dl>
        <t>
            If an AP is authenticating via an authoritative IdP, then the RP
            does not need to explicitly configure trust in the IdP at all.  The
            identity mechanism can directly verify that the IdP indeed made the
            relevant identity assertion (a function provided by the mechanisms
            in this document), and any assertion it makes about an identity for
            which it is authoritative is directly verifiable. Note that this
            does not mean that the IdP might not lie, but that is a
            trustworthiness judgement that the user can make at the time he
            looks at the identity.
        </t>
        <t>
            By contrast, if an AP is authenticating via a third-party IdP, the
            RP needs to explicitly trust that IdP (hence the need for an
            explicit trust anchor list in PKI-based SSL/TLS clients). The list
            of trustable IdPs needs to be configured directly into the browser,
            either by the user or potentially by the browser manufacturer. This
            is a significant advantage of authoritative IdPs and implies that if
            third-party IdPs are to be supported, the potential number needs to
            be fairly small.
        </t>
      </section>
      <section anchor="sec.overview" numbered="true" toc="default">
        <name>Overview of Operation</name>
        <t>
            In order to provide security without trusting the calling site, the
            PeerConnection component of the browser must interact directly with
            the IdP. The details of the mechanism are described in the W3C API
            specification, but the general idea is that the PeerConnection
            component downloads JS from a specific location on the IdP dictated
            by the IdP domain name. That JS (the "IdP proxy") runs in an
            isolated security context within the browser and the PeerConnection
            talks to it via a secure message passing channel.
        </t>
        <t>
            Note that there are two logically separate functions here:
        </t>
        <ul spacing="normal">
          <li>
                Identity assertion generation.
              </li>
          <li>
                Identity assertion verification.
              </li>
        </ul>
        <t>
            The same IdP JS "endpoint" is used for both functions but of course
            a given IdP might behave differently and load new JS to perform one
            function or the other.
        </t>

        <artwork name="" type="" align="left" alt=""><![CDATA[
     +--------------------------------------+
     | Browser                              |
     |                                      |
     | +----------------------------------+ |
     | | https://calling-site.example.com | |
     | |                                  | |
     | |        Calling JS Code           | |
     | |               ^                  | |
     | +---------------|------------------+ |
     |                 | API Calls          |
     |                 v                    |
     |          PeerConnection              |
     |                 ^                    |
     |                 | API Calls          |
     |     +-----------|-------------+      |   +---------------+
     |     |           v             |      |   |               |
     |     |       IdP Proxy         |<-------->|   Identity    |
     |     |                         |      |   |   Provider    |
     |     | https://idp.example.org |      |   |               |
     |     +-------------------------+      |   +---------------+
     |                                      |
     +--------------------------------------+
]]></artwork>
        <t>
            When the PeerConnection object wants to interact with the IdP, the
            sequence of events is as follows:
        </t>
        <ol spacing="normal" type="1">
          <li>
                The browser (the PeerConnection component) instantiates an IdP
                proxy. This allows the IdP to load whatever JS is necessary into
                the proxy.  The resulting code runs in the IdP's security
                context.
              </li>
          <li>
                The IdP registers an object with the browser that conforms to
                the API defined in <xref target="webrtc-api" format="default"/>.
              </li>
          <li>
                The browser invokes methods on the object registered by the IdP
                proxy to create or verify identity assertions.
              </li>
        </ol>
        <t>
            This approach allows us to decouple the browser from any particular
            identity provider; the browser need only know how to load the IdP's
            JavaScript--the location of which is determined based on the IdP's
            identity--and to call the generic API for requesting and verifying
            identity assertions. The IdP provides whatever logic is necessary to
            bridge the generic protocol to the IdP's specific
            requirements. Thus, a single browser can support any number of
            identity protocols, including being forward compatible with IdPs
            which did not exist at the time the browser was written.
        </t>
      </section>
      <section anchor="sec.standardized" numbered="true" toc="default">
        <name>Items for Standardization</name>
        <t>
            There are two parts to this work:
        </t>
        <ul spacing="normal">
          <li>
                The precise information from the signaling message that must be
                cryptographically bound to the user's identity and a mechanism
                for carrying assertions in JSEP messages. This is specified in
                <xref target="sec.jsep-binding" format="default"/>.
              </li>
          <li>
                The interface to the IdP, which is defined in the companion W3C
                WebRTC API specification <xref target="webrtc-api" format="default"/>.
              </li>
        </ul>
        <t>
            The WebRTC API specification also defines JavaScript interfaces that
            the calling application can use to specify which IdP to use.  That
            API also provides access to the assertion-generation capability and
            the status of the validation process.
        </t>
      </section>
      <section anchor="sec.jsep-binding" numbered="true" toc="default">
        <name>Binding Identity Assertions to JSEP Offer/Answer Transactions</name>
        <t>
            An identity assertion binds the user's identity (as asserted by the
            IdP) to the SDP offer/answer exchange and specifically to the
            media. In order to achieve this, the PeerConnection must provide the
            DTLS-SRTP fingerprint to be bound to the identity. This is provided
            as a JavaScript object (also known as a dictionary or hash) with a
            single <tt>fingerprint</tt> key, as shown below:
        </t>
        <artwork name="" type="" align="left" alt=""><![CDATA[
  {
    "fingerprint":
      [
        { "algorithm": "sha-256",
          "digest": "4A:AD:B9:B1:3F:...:E5:7C:AB" },
        { "algorithm": "sha-1",
          "digest": "74:E9:76:C8:19:...:F4:45:6B" }
      ]
  }
]]></artwork>
        <t>
            The <tt>fingerprint</tt> value is an array of
            objects.  Each object in the array contains <tt>algorithm</tt> and <tt>digest</tt> values, which correspond directly to
            the algorithm and digest values in the <tt>fingerprint</tt> attribute of the SDP <xref target="RFC8122" format="default"/>.
        </t>
        <t>
            This object is encoded in a <xref target="RFC8259" format="default">JSON</xref>
            string for passing to the IdP.  The identity assertion returned by
            the IdP, which is encoded in the <tt>identity</tt> attribute, is a JSON object that is
            encoded as described in <xref target="sec.carry-assertion" format="default"/>.
        </t>
        <t>
            This structure does not need to be interpreted by the IdP or the
            IdP proxy. It is consumed solely by the RP's browser.  The IdP
            merely treats it as an opaque value to be attested to.  Thus, new
            parameters can be added to the assertion without modifying the
            IdP.
        </t>
        <section anchor="sec.carry-assertion" numbered="true" toc="default">
          <name>Carrying Identity Assertions</name>
          <t>
              Once an IdP has generated an assertion (see <xref target="sec.request-assert" format="default"/>), it is attached to the SDP
              offer/answer message. This is done by adding a new 'identity'
              attribute to the SDP. The sole contents of this value is the
              identity assertion.  The identity assertion produced by the IdP is
              encoded into a UTF-8 JSON text, then <xref target="RFC4648" format="default">Base64-encoded</xref> to produce this string.
              For example:
          </t>
          <artwork name="" type="" align="left" alt=""><![CDATA[
v=0
o=- 1181923068 1181923196 IN IP4 ua1.example.com
s=example1
c=IN IP4 ua1.example.com
a=fingerprint:sha-1 \
  4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB
a=identity:\
  eyJpZHAiOnsiZG9tYWluIjoiZXhhbXBsZS5vcmciLCJwcm90b2NvbCI6ImJvZ3Vz\
  In0sImFzc2VydGlvbiI6IntcImlkZW50aXR5XCI6XCJib2JAZXhhbXBsZS5vcmdc\
  IixcImNvbnRlbnRzXCI6XCJhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3l6XCIsXCJz\
  aWduYXR1cmVcIjpcIjAxMDIwMzA0MDUwNlwifSJ9
a=...
t=0 0
m=audio 6056 RTP/SAVP 0
a=sendrecv
...
]]></artwork>

<t>Note that long lines in the example are folded to meet the column
width constraints of this document; the backslash ("\") at the end of
a line, the carriage return that follows, and whitespace shall be ignored.</t>
          <t>
              The 'identity' attribute attests to all <tt>fingerprint</tt> attributes in the session
              description. It is therefore a session-level attribute.
          </t>
          <t>
              Multiple <tt>fingerprint</tt> values can be
              used to offer alternative certificates for a peer.  The <tt>identity</tt> attribute <bcp14>MUST</bcp14> include all
              fingerprint values that are included in <tt>fingerprint</tt> attributes of the session
              description.
          </t>
          <t>
              The RP browser <bcp14>MUST</bcp14> verify that the in-use certificate for a DTLS
              connection is in the set of fingerprints returned from the IdP
              when verifying an assertion.
          </t>
        </section>
      </section>
      <section anchor="sec.idp-uri" numbered="true" toc="default">
        <name>Determining the IdP URI</name>
        <t>
                In order to ensure that the IdP is under control of the domain
                owner rather than someone who merely has an account on the
                domain owner's server (e.g., in shared hosting scenarios), the
                IdP JavaScript is hosted at a deterministic location based on
                the IdP's domain name.  Each IdP proxy instance is associated
                with two values:
        </t>
        <dl newline="false" spacing="normal" indent="3">
          <dt>Authority:</dt>
          <dd>
                       The <xref target="RFC3986" format="default"> authority</xref> at which the
                       IdP's service is hosted.
                  </dd>
          <dt>protocol:</dt>
          <dd>
                    The specific IdP protocol which the IdP is using. This is a
                    completely opaque IdP-specific string, but allows an IdP to
                    implement two protocols in parallel. This value may be the
                    empty string.  If no value for protocol is provided, a value
                    of "default" is used.
                  </dd>
        </dl>
        <t>
                Each IdP <bcp14>MUST</bcp14> serve its initial entry page (i.e., the one loaded
                by the IdP proxy) from a <xref target="RFC5785" format="default">well-known
                URI</xref>.  The well-known URI for an IdP proxy is formed from
                the following URI components:
        </t>
        <ol spacing="normal" type="1">
          <li>
                    The scheme, "https:".  An IdP <bcp14>MUST</bcp14> be loaded using <xref target="RFC2818" format="default">HTTPS</xref>.
                  </li>
          <li>
                    The <xref target="RFC3986" format="default">authority</xref>.  As noted above,
                    the authority <bcp14>MAY</bcp14> contain a  non-default port number or
                    userinfo sub-component.  Both are removed when determining
                    if an asserted identity matches the name of the IdP.
                  </li>
          <li>
                    The path, starting with "/.well-known/idp-proxy/" and
                    appended with the IdP protocol.  Note that the separator
                    characters '/' (%2F) and '\' (%5C) <bcp14>MUST&nbsp;NOT</bcp14> be permitted in
                    the protocol field, lest an attacker be able to direct
                    requests outside of the controlled "/.well-known/" prefix.
                    Query and fragment values <bcp14>MAY</bcp14> be used by including '?' or
                    '#' characters.
                  </li>
        </ol>
        <t>
                For example, for the IdP "identity.example.com" and the protocol
                "example", the URL would be:
        </t>
        <artwork name="" type="" align="left" alt=""><![CDATA[
  https://identity.example.com/.well-known/idp-proxy/example
  ]]></artwork>
        <t>
                The IdP <bcp14>MAY</bcp14> redirect requests to this URL, but they <bcp14>MUST</bcp14> retain
                the "https" scheme.  This changes the effective origin of the
                IdP, but not the domain of the identities that the IdP is
                permitted to assert and validate. I.e., the IdP is still
                regarded as authoritative for the original domain.
        </t>
        <section numbered="true" toc="default">
          <name>Authenticating Party</name>
          <t>
                  How an AP determines the appropriate IdP domain is out of
                  scope of this specification. In general, however, the AP has
                  some actual account relationship with the IdP, as this
                  identity is what the IdP is attesting to. Thus, the AP somehow
                  supplies the IdP information to the browser. Some potential
                  mechanisms include:
          </t>
          <ul spacing="normal">
            <li>
                      Provided by the user directly.
                    </li>
            <li>
                      Selected from some set of IdPs known to the calling site.
                      E.g., a button that shows "Authenticate via Facebook
                      Connect"
                    </li>
          </ul>
        </section>
        <section numbered="true" toc="default">
          <name>Relying Party</name>
          <t>
                  Unlike the AP, the RP need not have any particular
                  relationship with the IdP. Rather, it needs to be able to
                  process whatever assertion is provided by the AP.  As the
                  assertion contains the IdP's identity in the <tt>idp</tt> field of the JSON-encoded object (see
                  <xref target="sec.request-assert" format="default"/>), the URI can be
                  constructed directly from the assertion, and thus the RP can
                  directly verify the technical validity of the assertion with
                  no user interaction. Authoritative assertions need only be
                  verifiable. Third-party assertions also <bcp14>MUST</bcp14> be verified
                  against local policy, as described in <xref target="sec.id-format" format="default"/>.
          </t>
        </section>
      </section>
      <section anchor="sec.request-assert" numbered="true" toc="default">
        <name>Requesting Assertions</name>
        <t>
                The input to identity assertion is the JSON-encoded object
                described in <xref target="sec.jsep-binding" format="default"/> that contains the
                set of certificate fingerprints the browser intends to use.
                This string is treated as opaque from the perspective of the
                IdP.
        </t>
        <t>
                The browser also identifies the origin that the PeerConnection
                is run in, which allows the IdP to make decisions based on who
                is requesting the assertion.
        </t>
        <t>
                An application can optionally provide a user identifier hint
                when specifying an IdP.  This value is a hint that the IdP can
                use to select amongst multiple identities, or to avoid providing
                assertions for unwanted identities.  The <tt>username</tt> is a string that has no meaning to
                any entity other than the IdP, it can contain any data the IdP
                needs in order to correctly generate an assertion.
        </t>
        <t>
                An identity assertion that is successfully provided by the IdP
                consists of the following information:
        </t>
        <dl newline="false" spacing="normal" indent="3">
          <dt>idp:</dt>
          <dd>
                    The domain name of an IdP and the protocol string.  This
		    <bcp14>MAY</bcp14> identify a different IdP or protocol from the one that
                    generated the assertion.
                  </dd>
          <dt>assertion:</dt>
          <dd>
                    An opaque value containing the assertion itself. This is
                    only interpretable by the identified IdP or the IdP code
                    running in the client.
                  </dd>
        </dl>
        <t>
                <xref target="fig.assert-ex" format="default"/> shows an example assertion
                formatted as JSON.  In this case, the message has presumably
                been digitally signed/MACed in some way that the IdP can later
                verify it, but this is an implementation detail and out of scope
                of this document.              </t>
        <figure anchor="fig.assert-ex">
          <name>Example assertion</name>
          <sourcecode name="json1" type="json"><![CDATA[
{
  "idp":{
    "domain": "example.org",
    "protocol": "bogus"
  },
  "assertion": "{\"identity\":\"bob@example.org\",
                 \"contents\":\"abcdefghijklmnopqrstuvwyz\",
                 \"signature\":\"010203040506\"}"
}
]]></sourcecode>
        </figure>
        <t>
                For use in signaling, the assertion is serialized into JSON,
                <xref target="RFC4648" format="default">Base64-encoded</xref>, and used as the
                value of the <tt>identity</tt> attribute.
                IdPs <bcp14>SHOULD</bcp14> ensure that any assertions they
                generate cannot be interpreted in a different context. E.g.,
                they should use a distinct format or have separate cryptographic
                keys for assertion generation and other purposes.
                Line breaks are inserted solely for
                readability.
        </t>
      </section>
      <section anchor="sec.user-login" numbered="true" toc="default">
        <name>Managing User Login</name>
        <t>
                In order to generate an identity assertion, the IdP needs proof of
                the user's identity.  It is common practice to authenticate users
                (using passwords or multi-factor authentication), then use <xref target="RFC6265" format="default">Cookies</xref> or <xref target="RFC7617" format="default">HTTP
                authentication</xref> for subsequent exchanges.
        </t>
        <t>
                The IdP proxy is able to access cookies, HTTP authentication or
                other persistent session data because it operates in the security
                context of the IdP origin.  Therefore, if a user is logged in, the
                IdP could have all the information needed to generate an
                assertion.
        </t>
        <t>
                An IdP proxy is unable to generate an assertion if the user is
                not logged in, or the IdP wants to interact with the user to
                acquire more information before generating the assertion.  If
                the IdP wants to interact with the user before generating an
                assertion, the IdP proxy can fail to generate an assertion and
                instead indicate a URL where login should proceed.
        </t>
        <t>
                The application can then load the provided URL to enable the
                user to enter credentials.  The communication between the
                application and the IdP is described in <xref target="webrtc-api" format="default"/>.
        </t>
      </section>
    </section>
    <section anchor="sec.verify-assert" numbered="true" toc="default">
      <name>Verifying Assertions</name>
      <t>
                The input to identity validation is the assertion string taken
                from a decoded 'identity' attribute.
      </t>
      <t>
                The IdP proxy verifies the assertion. Depending on the identity
                protocol, the proxy might contact the IdP server or other
                servers.  For instance, an OAuth-based protocol will likely
                require using the IdP as an oracle, whereas with a
                signature-based scheme might be able to verify the assertion
                without contacting the IdP, provided that it has cached the
                relevant public key.
      </t>
      <t>
                Regardless of the mechanism, if verification succeeds, a
                successful response from the IdP proxy consists of the following
                information:
      </t>
      <dl newline="false" spacing="normal" indent="3">
        <dt>identity:</dt>
        <dd>
                    The identity of the AP from the IdP's perspective. Details
                    of this are provided in <xref target="sec.id-format" format="default"/>.
                  </dd>
        <dt>contents:</dt>
        <dd>
                    The original unmodified string provided by the AP as input
                    to the assertion generation process.
                  </dd>
      </dl>
      <t>
                <xref target="fig.verify-ex" format="default"/> shows an example response,
                which is JSON-formatted.
      </t>
      <figure anchor="fig.verify-ex">
        <name>Example verification result</name>
        <sourcecode name="json2" type="json"><![CDATA[
{
  "identity": "bob@example.org",
  "contents": "{\"fingerprint\":[ ... ]}"
}
]]></sourcecode>
      </figure>
      <section anchor="sec.id-format" numbered="true" toc="default">
        <name>Identity Formats</name>
        <t>
                  The identity provided from the IdP to the RP browser <bcp14>MUST</bcp14>
                  consist of a string representing the user's identity.  This
                  string is in the form "&lt;user&gt;@&lt;domain&gt;", where <tt>user</tt> consists of any character,
                  and domain is aninternationalized
                  domain name <xref target="RFC5890" format="default"/> encoded as a sequence of U-labels.
        </t>
        <t>
                  The PeerConnection API <bcp14>MUST</bcp14> check this string as follows:
        </t>
        <ol spacing="normal" type="1">
          <li>
                      If the "domain" portion of the string is equal to the domain
                      name of the IdP proxy, then the assertion is valid, as the
                      IdP is authoritative for this domain.  Comparison of
                      domain names is done using the label equivalence rule
                      defined in <xref target="RFC5890" sectionFormat="of" section="2.3.2.4"/>.
                    </li>
          <li>
            <t>
                      If the "domain" portion of the string is not equal to the
                      domain name of the IdP proxy, then the PeerConnection
                      object <bcp14>MUST</bcp14> reject the assertion unless both:
            </t>
            <ol spacing="normal" type="a">
              <li>
                          the IdP domain is trusted as an acceptable third-party
                          IdP; and
                        </li>
              <li>
                          local policy is configured to trust this IdP domain
                          for the domain portion of the identity string.
                        </li>
            </ol>
          </li>
        </ol>
        <t>
                  Any "@" or "%" characters in the "user" portion of the
                  identity <bcp14>MUST</bcp14> be escaped according to the "Percent-Encoding"
                  rules defined in <xref target="RFC3986" sectionFormat="of" section="2.1"/>. Characters other than "@" and "%" <bcp14>MUST&nbsp;NOT</bcp14>
                  be percent-encoded. For example, with a "user" of "user@133" and
                  a "domain" of "identity.example.com", the resulting string will
                  be encoded as "user%40133@identity.example.com".
        </t>
        <t>
                  Implementations are cautioned to take care when displaying
                  user identities containing escaped "@" characters. If such
                  characters are unescaped prior to display, implementations
                  <bcp14>MUST</bcp14> distinguish between the domain of the IdP proxy and any
                  domain that might be implied by the portion of the
                  "&lt;user&gt;" portion that appears after the escaped "@"
                  sign.
        </t>
      </section>
    </section>
    <section anchor="sec.sec-cons" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>
          Much of the security analysis of this problem is contained in <xref target="RFC9998" format="default"/> or in the discussion of the
          particular issues above. In order to avoid repetition, this section
          focuses on (a) residual threats that are not addressed by this
          document and (b) threats produced by failure/misbehavior of one of the
          components in the system.
      </t>
      <section numbered="true" toc="default">
        <name>Communications Security</name>
        <t>
            IF HTTPS is not used to secure communications to the signaling
            server, and the identity mechanism used in
            <xref target="sec.generic.idp" format="default"/> is not used,
            then any on-path attacker can replace the DTLS-SRTP fingerprints
            in the handshake and thus substitute its own identity for that
            of either endpoint.
        </t>
        <t>
            Even if HTTPS is used, the signaling server can
            potentially mount a man-in-the-middle attack unless implementations
            have some mechanism for independently verifying keys. The UI
            requirements in <xref target="sec.proposal.comsec" format="default"/> are designed to
            provide such a mechanism for motivated/security conscious users, but
            are not suitable for general use.  The identity service mechanisms
            in <xref target="sec.generic.idp" format="default"/> are more suitable for general
            use. Note, however, that a malicious signaling service can strip off
            any such identity assertions, though it cannot forge new ones.  Note
            that all of the third-party security mechanisms available (whether
            X.509 certificates or a third-party IdP) rely on the security of the
            third party--this is of course also true of the user's connection to the
            Web site itself. Users who wish to assure themselves of security
            against a malicious identity provider can only do so by verifying
            peer credentials directly, e.g., by checking the peer's fingerprint
            against a value delivered out of band.
        </t>
        <t>
            In order to protect against malicious content JavaScript, that
            JavaScript <bcp14>MUST&nbsp;NOT</bcp14> be allowed to have direct access to---or perform
            computations with---DTLS keys. For instance, if content JS were able
            to compute digital signatures, then it would be possible for content
            JS to get an identity assertion for a browser's generated key and
            then use that assertion plus a signature by the key to authenticate
            a call protected under an ephemeral Diffie-Hellman (DH) key controlled by the content
            JS, thus violating the security guarantees otherwise provided by the
            IdP mechanism. Note that it is not sufficient merely to deny the
            content JS direct access to the keys, as some have suggested doing
            with the WebCrypto API <xref target="webcrypto" format="default"/>.  The JS must
            also not be allowed to perform operations that would be valid for a
            DTLS endpoint. By far the safest approach is simply to deny the
            ability to perform any operations that depend on secret information
            associated with the key. Operations that depend on public
            information, such as exporting the public key are of course safe.
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>Privacy</name>
        <t>
            The requirements in this document are intended to allow:
        </t>
        <ul spacing="normal">
          <li>
                Users to participate in calls without revealing their location.
              </li>
          <li>
                Potential callees to avoid revealing their location and even
                presence status prior to agreeing to answer a call.
              </li>
        </ul>
        <t>
            However, these privacy protections come at a performance cost in
            terms of using TURN relays and, in the latter case, delaying
            ICE. Sites <bcp14>SHOULD</bcp14> make users aware of these tradeoffs.
        </t>
        <t>
            Note that the protections provided here assume a non-malicious
            calling service. As the calling service always knows the users
            status and (absent the use of a technology like Tor) their IP
            address, they can violate the users privacy at will.  Users who wish
            privacy against the calling sites they are using must use separate
            privacy enhancing technologies such as Tor. Combined WebRTC/Tor
            implementations <bcp14>SHOULD</bcp14> arrange to route the media as well as the
            signaling through Tor. Currently this will produce very suboptimal
            performance.
        </t>
        <t>
            Additionally, any identifier which persists across multiple calls is
            potentially a problem for privacy, especially for anonymous calling
            services. Such services <bcp14>SHOULD</bcp14> instruct the browser to use separate
            DTLS keys for each call and also to use TURN throughout the
            call. Otherwise, the other side will learn linkable information that
            would allow them to correlate the browser across multiple calls.
            Additionally, browsers <bcp14>SHOULD</bcp14> implement the privacy-preserving CNAME
            generation mode of <xref target="RFC7022" format="default"/>.
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>Denial of Service</name>
        <t>
            The consent mechanisms described in this document are intended to
            mitigate denial of service attacks in which an attacker uses clients
            to send large amounts of traffic to a victim without the consent of
            the victim. While these mechanisms are sufficient to protect victims
            who have not implemented WebRTC at all, WebRTC implementations need
            to be more careful.
        </t>
        <t>
            Consider the case of a call center which accepts calls via
            WebRTC. An attacker proxies the call center's front-end and arranges
            for multiple clients to initiate calls to the call center. Note that
            this requires user consent in many cases but because the data
            channel does not need consent, he can use that directly. Since ICE
            will complete, browsers can then be induced to send large amounts of
            data to the victim call center if it supports the data channel at
            all. Preventing this attack requires that automated WebRTC
            implementations implement sensible flow control and have the ability
            to triage out (i.e., stop responding to ICE probes on) calls which
            are behaving badly, and especially to be prepared to remotely
            throttle the data channel in the absence of plausible audio and
            video (which the attacker cannot control).
        </t>
        <t>
            Another related attack is for the signaling service to swap the ICE
            candidates for the audio and video streams, thus forcing a browser
            to send video to the sink that the other victim expects will contain
            audio (perhaps it is only expecting audio!)  potentially causing
            overload.  Muxing multiple media flows over a single transport makes
            it harder to individually suppress a single flow by denying ICE
            keepalives. Either media-level (RTCP) mechanisms must be used or the
            implementation must deny responses entirely, thus terminating the
            call.
        </t>
        <t>
            Yet another attack, suggested by Magnus Westerlund, is for the
            attacker to cross-connect offers and answers as follows. It induces
            the victim to make a call and then uses its control of other users
            browsers to get them to attempt a call to someone. It then
            translates their offers into apparent answers to the victim, which
            looks like large-scale parallel forking.  The victim still responds
            to ICE responses and now the browsers all try to send media to the
            victim.  Implementations can defend themselves from this attack by
            only responding to ICE Binding Requests for a limited number of
            remote ufrags (this is the reason for the requirement that the JS
            not be able to control the ufrag and password).
        </t>
        <t>
            <xref target="RFC9994" sectionFormat="comma" section="13"/> documents a number
            of potential RTCP-based DoS attacks and countermeasures.
        </t>
        <t>
            Note that attacks based on confusing one end or the other about
            consent are possible even in the face of the third-party identity
            mechanism as long as major parts of the signaling messages are not
            signed. On the other hand, signing the entire message severely
            restricts the capabilities of the calling application, so there are
            difficult tradeoffs here.
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>IdP Authentication Mechanism</name>
        <t>
            This mechanism relies for its security on the IdP and on the
            PeerConnection correctly enforcing the security invariants described
            above. At a high level, the IdP is attesting that the user
            identified in the assertion wishes to be associated with the
            assertion. Thus, it must not be possible for arbitrary third parties
            to get assertions tied to a user or to produce assertions that RPs
            will accept.
        </t>
        <section anchor="sec.pc-origin" numbered="true" toc="default">
          <name>PeerConnection Origin Check</name>
          <t>
              Fundamentally, the IdP proxy is just a piece of HTML and JS loaded
              by the browser, so nothing stops a Web attacker from creating
              their own IFRAME, loading the IdP proxy HTML/JS, and requesting a
              signature over his own keys rather than those generated in
              the browser. However, that proxy would be in the
              attacker's origin, not the IdP's origin. Only the
              browser itself can instantiate a context that (a) is in the IdP's origin and
              (b) exposes the correct API surface. Thus, the IdP proxy on
              the sender's side <bcp14>MUST</bcp14> ensure that it is running in the IdP's origin
              prior to issuing assertions.
          </t>
          <t>
              Note that this check only asserts that the browser (or some other
              entity with access to the user's authentication data) attests to
              the request and hence to the fingerprint.  It does not demonstrate
              that the browser has access to the associated private
              key, and therefore an attacker can attach their own identity
              to another party's keying material, thus making a call which
              comes from Alice appear to come from the attacker.
              See <xref target="RFC9997" format="default"/> for defenses against this
              form of attack.
          </t>
        </section>
        <section anchor="sec.sec-idp-uri" numbered="true" toc="default">
          <name>IdP Well-known URI</name>
          <t>
              As described in <xref target="sec.idp-uri" format="default"/> the IdP proxy HTML/JS
              landing page is located at a well-known URI based on the IdP's
              domain name. This requirement prevents an attacker who can write
              some resources at the IdP (e.g., on one's Facebook wall) from
              being able to impersonate the IdP.
          </t>
        </section>
        <section numbered="true" toc="default">
          <name>Privacy of IdP-generated identities and the hosting site</name>
          <t>
              Depending on the structure of the IdP's assertions, the calling
              site may learn the user's identity from the perspective of the
              IdP.  In many cases this is not an issue because the user is
              authenticating to the site via the IdP in any case, for instance
              when the user has logged in with Facebook Connect and is then
              authenticating their call with a Facebook identity.  However, in
              other case, the user may not have already revealed their identity
              to the site.  In general, IdPs <bcp14>SHOULD</bcp14> either verify that the user
              is willing to have their identity revealed to the site (e.g.,
              through the usual IdP permissions dialog) or arrange that the
              identity information is only available to known RPs (e.g., social
              graph adjacencies) but not to the calling site. The "domain" field
              of the assertion request can be used to check that the user has
              agreed to disclose their identity to the calling site; because it
              is supplied by the PeerConnection it can be trusted to be correct.
          </t>
        </section>
        <section anchor="sec.sec-third-party" numbered="true" toc="default">
          <name>Security of Third-Party IdPs</name>
          <t>
              As discussed above, each third-party IdP represents a new
              universal trust point and therefore the number of these IdPs needs
              to be quite limited. Most IdPs, even those which issue unqualified
              identities such as Facebook, can be recast as authoritative IdPs
              (e.g., 123456@facebook.com). However, in such cases, the user
              interface implications are not entirely desirable.  One
              intermediate approach is to have special (potentially user
              configurable) UI for large authoritative IdPs, thus allowing the
              user to instantly grasp that the call is being authenticated by
              Facebook, Google, etc.
          </t>
          <section numbered="true" toc="default">
            <name>Confusable Characters</name>
            <t>
                Because a broad range of characters are permitted in identity
                strings, it may be possible for attackers to craft identities
                which are confusable with other identities (see
                <xref target="RFC6943" format="default"/> for more on this topic). This is
                a problem with any identifier space of this type
                (e.g., e-mail addresses).
                Those minting identifers should avoid mixed scripts and similar
                confusable characters. Those presenting these identifiers to a
                user should consider highlighting cases of mixed script usage
                (see <xref target="RFC5890" sectionFormat="comma" section="4.4"/>). Other best practices are still in development.
            </t>
          </section>
        </section>
        <section numbered="true" toc="default">
          <name>Web Security Feature Interactions</name>
          <t>
              A number of optional Web security features have the potential to
              cause issues for this mechanism, as discussed below.
          </t>
          <section anchor="sec.popup-blocking" numbered="true" toc="default">
            <name>Popup Blocking</name>
            <t>
                When popup blocking is in use, the IdP proxy is unable to generate popup windows, dialogs or
                any other form of user interactions.  This prevents the IdP
                proxy from being used to circumvent user interaction.  The
                "LOGINNEEDED" message allows the IdP proxy to inform the calling
                site of a need for user login, providing the information
                necessary to satisfy this requirement without resorting to
                direct user interaction from the IdP proxy itself.
            </t>
          </section>
          <section anchor="sec.3rd-party-cookies" numbered="true" toc="default">
            <name>Third Party Cookies</name>
            <t>
                Some browsers allow users to block third party cookies (cookies
                associated with origins other than the top level page) for
                privacy reasons.  Any IdP which uses cookies to persist logins
                will be broken by third-party cookie blocking. One option is to
                accept this as a limitation; another is to have the
                PeerConnection object disable third-party cookie blocking for
                the IdP proxy.
            </t>
          </section>
        </section>
      </section>
    </section>
    <section anchor="sec.iana-cons" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>
          This specification defines the <tt>identity</tt>
          SDP attribute per the procedures of <xref target="RFC4566"
	  sectionFormat="of" section="8.2.4"/>.  The required information for the registration is
          included here:
      </t>
      <dl newline="false" spacing="normal" indent="3">
        <dt>Contact Name:</dt>
        <dd>IESG (iesg@ietf.org)</dd>
        <dt>Attribute Name:</dt>
        <dd>identity</dd>
        <dt>Long Form:</dt>
        <dd>identity</dd>
        <dt>Type of Attribute:</dt>
        <dd>session-level</dd>
        <dt>Charset Considerations:</dt>
        <dd>This attribute is not subject
            to the charset attribute.</dd>
        <dt>Purpose:</dt>
        <dd>This attribute carries an identity assertion,
            binding an identity to the transport-level security session.</dd>
        <dt>Appropriate Values:</dt>
        <dd>See <xref target="sec.sdp-id-attr" format="default"/> of RFC XXXX
</dd>
        <dt>Mux Category:</dt>
        <dd>NORMAL.</dd>
      </dl>
      <t>
          This section reqisters the <tt>idp-proxy</tt> well-known
          URI from <xref target="RFC5785" format="default"/>.
      </t>
      <dl newline="false" spacing="normal" indent="3">
        <dt>URI suffix:</dt>
        <dd>idp-proxy</dd>
        <dt>Change controller:</dt>
        <dd>IETF</dd>
      </dl>
    </section>

  </middle>
  <back>

    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2818.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3264.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3711.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3986.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4566.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4568.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4648.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5763.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5764.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5785.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5890.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6347.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6454.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7022.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7675.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7918.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8122.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8259.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8261.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8445.xml"/>

        <reference anchor="RFC9995" xml:base="https://www.rfc-editor.org/info/rfc9998.xml" target="https://www.rfc-editor.org/info/rfc9998">
          <front>
            <title>Overview: Real Time Protocols for Browser-based Applications</title>
            <seriesInfo name="RFC" value="9995"/>
            <seriesInfo name="DOI" value="10.17487/RFC9995"/>
            <author initials="H" surname="Alvestrand" fullname="Harald Alvestrand">
              <organization/>
            </author>
            <date month="November" year="2017"/>
          </front>
        </reference>

        <reference anchor="RFC9998" xml:base="https://www.rfc-editor.org/info/rfc9998.xml" target="https://www.rfc-editor.org/info/rfc9998">
          <front>
            <title>Security Considerations for WebRTC</title>
            <seriesInfo name="RFC" value="9998"/>
            <seriesInfo name="DOI" value="10.17487/RFC9998"/>
            <author initials="E" surname="Rescorla" fullname="Eric Rescorla">
              <organization/>
            </author>
            <date month="August" year="2019"/>
          </front>
        </reference>

        <reference anchor="RFC9994" xml:base="https://www.rfc-editor.org/info/rfc9998.xml" target="https://www.rfc-editor.org/info/rfc9994">
          <front>
            <title>Web Real-Time Communication (WebRTC): Media Transport and Use of RTP</title>
            <seriesInfo name="RFC" value="9994"/>
            <seriesInfo name="DOI" value="10.17487/RFC9994"/>
            <author initials="C" surname="Perkins" fullname="Colin Perkins">
              <organization/>
            </author>
            <author initials="M" surname="Westerlund" fullname="Magnus Westerlund">
              <organization/>
            </author>
            <author initials="J" surname="Ott" fullname="Joerg Ott">
              <organization/>
            </author>
            <date month="March" year="2016"/>
          </front>
        </reference>

<!-- 7/31/2019  Not in our queue yet, but listed as Normative.  Maybe it's
     one of those doc.s that will be approved any day now?
     Called it "[RFC9997]" anyway -->
        <reference anchor="RFC9997" xml:base="https://www.rfc-editor.org/info/rfc9997.xml" target="https://www.rfc-editor.org/info/rfc9997">
          <front>
            <title>Unknown Key Share Attacks on uses of TLS with the Session
 Description Protocol (SDP)</title>
            <seriesInfo name="RFC" value="9997"/>
            <seriesInfo name="DOI" value="10.17487/RFC9997"/>
            <author initials="M" surname="Thomson" fullname="Martin Thomson">
              <organization/>
            </author>
            <author initials="E" surname="Rescorla" fullname="Eric Rescorla">
              <organization/>
            </author>
            <date month="August" year="2019"/>
          </front>
        </reference>

        <reference anchor="RFC9996" xml:base="https://www.rfc-editor.org/info/r
fc9996.xml" target="https://www.rfc-editor.org/info/rfc9996">
          <front>
            <title>JavaScript Session Establishment Protocol</title>
            <seriesInfo name="RFC" value="9996"/>
            <seriesInfo name="DOI" value="10.17487/RFC9996"/>
            <author initials="J" surname="Uberti" fullname="Justin Uberti">
              <organization/>
            </author>
            <author initials="C" surname="Jennings" fullname="Cullen Jennings">
              <organization/>
            </author>
            <author initials="E" surname="Rescorla" fullname="Eric Rescorla">
              <organization/>
            </author>
            <date month="February" year="2019"/>
          </front>
        </reference>

     <reference anchor="webcrypto" target="https://www.w3.org/TR/WebCryptoAPI/">
          <front>
            <title>Web Cryptography API</title>
            <author>
              <organization>W3C</organization>
            </author>
            <date month="June" year="2013"/>
          </front>
     </reference>

        <reference anchor="webrtc-api" target="https://dev.w3.org/2011/webrtc/editor/webrtc.html">
          <front>
            <title>WebRTC 1.0: Real-time Communication Between Browsers</title>
            <author>
              <organization>W3C</organization>
            </author>
            <date month="October" year="2011"/>
          </front>
        </reference>
        <reference anchor="FIPS186">
          <front>
            <title>Digital Signature Standard (DSS)</title>
            <seriesInfo name="NIST PUB 186-4" value=""/>
            <author>
              <organization>National Institute of Standards and Technology (NIST)</organization>
            </author>
            <date year="2013" month="July"/>
          </front>
        </reference>
      </references>
      <references>
        <name>Informative References</name>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7617.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3261.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5705.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6455.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6265.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6943.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6120.xml"/>

        <reference anchor="XmlHttpRequest" target="https://www.w3.org/TR/XMLHttpRequest/">
          <front>
            <title>XMLHttpRequest Level 2</title>
            <author initials="A." surname="van Kesteren">
              <organization/>
            </author>
            <date month="January" year="2012"/>
          </front>
        </reference>
      </references>
    </references>

    <section numbered="false" toc="default">
      <name>Acknowledgements</name>
      <t>
        Bernard Aboba, Harald Alvestrand, Richard Barnes, Dan Druta, Cullen
        Jennings, Hadriel Kaplan, Matthew Kaufman, Jim McEachern, Martin
        Thomson, Magnus Westerland.  Matthew Kaufman provided the UI material in
        <xref target="sec.proposal.comsec" format="default"/>. Christer Holmberg provided
        the initial version of <xref target="sec.sdp-id-attr-oa" format="default"/>.
      </t>
    </section>
  </back>
</rfc>
