<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.6.17 (Ruby 2.6.4) -->
<?rfc tocindent="yes"?>
<?rfc strict="yes"?>
<?rfc compact="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc-ext html-pretty-print="prettyprint https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"?>
<rfc xmlns:x="http://purl.org/net/xml2rfc/ext"
      category="exp"
      docName="draft-ietf-httpbis-http2-encryption-latest"
      ipr="trust200902"
      sortRefs="true"
      symRefs="true"
      tocInclude="true">
   <x:feedback template="mailto:quic@ietf.org?subject={docname},%20%22{section}%22\&amp;amp;body=%3c{ref}%3e:"/>
   <front>
      <title abbrev="Opportunistic HTTP/2 Security">Opportunistic Security for HTTP/2</title>
      <author fullname="Mark Nottingham" initials="M." surname="Nottingham">
         <address>
            <email>mnot@mnot.net</email>
            <uri>https://www.mnot.net/</uri>
         </address>
      </author>
      <author fullname="Martin Thomson" initials="M." surname="Thomson">
         <organization>Mozilla</organization>
         <address>
            <email>martin.thomson@gmail.com</email>
         </address>
      </author>
      <date year="2018"/>
      <area>Applications and Real-Time</area>
      <workgroup>HTTP</workgroup>
      <keyword>Internet-Draft</keyword>
      <abstract>
         <t>This document describes how <spanx style="verb">http</spanx> URIs can be accessed using Transport Layer Security (TLS) and HTTP/2 to mitigate pervasive monitoring attacks. This mechanism not a replacement for <spanx style="verb">https</spanx> URIs; it is vulnerable to active attacks.</t>
      </abstract>
   </front>
   <middle>
      <section anchor="introduction">
         <name>Introduction</name>
         <t>This document describes a use of HTTP Alternative Services <xref target="RFC7838"/> to decouple the URI scheme from the use and configuration of underlying encryption. It allows an <spanx style="verb">http</spanx> URI to be accessed using HTTP/2 <xref target="RFC7230"/> and Transport Layer Security (TLS) <xref target="RFC5246"/> with Opportunistic Security <xref target="RFC7435"/>.</t>
         <t>This document describes a usage model whereby sites can serve <spanx style="verb">http</spanx> URIs over TLS, thereby avoiding the problem of serving Mixed Content (described in <xref target="W3C.CR-mixed-content-20160802"/>) while still providing protection against passive attacks.</t>
         <t>Opportunistic Security does not provide the same guarantees as using TLS with <spanx style="verb">https</spanx> URIs, because it is vulnerable to active attacks, and does not change the security context of the connection. Normally, users will not be able to tell that it is in use (i.e., there will be no "lock icon").</t>
         <section anchor="goals-and-non-goals">
            <name>Goals and Non-Goals</name>
            <t>The immediate goal is to make the use of HTTP more robust in the face of pervasive passive monitoring <xref target="RFC7258"/>.</t>
            <t>A secondary (but significant) goal is to provide for ease of implementation, deployment and operation. This mechanism is expected to have a minimal impact upon performance, and require a trivial administrative effort to configure.</t>
            <t>Preventing active attacks (such as a Man-in-the-Middle) is a non-goal for this specification. Furthermore, this specification is not intended to replace or offer an alternative to <spanx style="verb">https</spanx>, since <spanx style="verb">https</spanx> both prevents active attacks and invokes a more stringent security model in most clients.</t>
         </section>
         <section anchor="notational-conventions">
            <name>Notational Conventions</name>
            <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in <xref target="RFC2119"/>.</t>
         </section>
      </section>
      <section anchor="using-http-uris-over-tls">
         <name>Using HTTP URIs over TLS</name>
         <t>An origin server that supports the resolution of <spanx style="verb">http</spanx> URIs can indicate support for this specification by providing an alternative service advertisement <xref target="RFC7838"/> for a protocol identifier that uses TLS, such as <spanx style="verb">h2</spanx>
            <xref target="RFC7540"/>. Such a protocol MUST include an explicit indication of the scheme of the resource. This excludes HTTP/1.1; HTTP/1.1 clients are forbidden from including the absolute form of a URI in requests to origin servers (see <xref target="RFC7230" x:fmt="of" x:sec="5.3.1"/>).</t>
         <t>A client that receives such an advertisement MAY make future requests intended for the associated origin <xref target="RFC6454"/> to the identified service (as specified by <xref target="RFC7838"/>), provided that the alternative service opts in as described in <xref target="opt-in"/>.</t>
         <t>A client that places the importance of protection against passive attacks over performance might choose to withhold requests until an encrypted connection is available. However, if such a connection cannot be successfully established, the client can resume its use of the cleartext connection.</t>
         <t>A client can also explicitly probe for an alternative service advertisement by sending a request that bears little or no sensitive information, such as one with the OPTIONS method. Likewise, clients with existing alternative services information could make such a request before they expire, in order minimize the delays that might be incurred.</t>
         <t>Client certificates are not meaningful for URLs with the <spanx style="verb">http</spanx> scheme, and therefore clients creating new TLS connections to alternative services for the purposes of this specification MUST NOT present them. A server that also provides <spanx style="verb">https</spanx> resources on the same port can request a certificate during the TLS handshake, but it MUST NOT abort the handshake if the client does not provide one.</t>
         <section anchor="opt-in">
            <name>Alternative Server Opt-In</name>
            <t>It is possible that the server might become confused about whether requests' URLs have a <spanx style="verb">http</spanx> or <spanx style="verb">https</spanx> scheme, for various reasons; see <xref target="confuse"/>. To ensure that the alternative service has opted into serving <spanx style="verb">http</spanx> URLs over TLS, clients are required to perform additional checks before directing <spanx style="verb">http</spanx> requests to it.</t>
            <t>Clients MUST NOT send <spanx style="verb">http</spanx> requests over a secured connection, unless the chosen alternative service presents a certificate that is valid for the origin as defined in <xref target="RFC2818"/>. Using an authenticated alternative service establishes "reasonable assurances" for the purposes of <xref target="RFC7838"/>. In addition to authenticating the server, the client MUST have obtained a valid http-opportunistic response for an origin (as per <xref target="well-known"/>) using the authenticated connection. An exception to the latter restriction is made for requests for the "http-opportunistic" well-known URI.</t>
            <t>For example, assuming the following request is made over a TLS connection that is successfully authenticated for those origins, the following request/response pair would allow requests for the origins "http://www.example.com" or "http://example.com" to be sent using a secured connection:</t>
            <figure>
               <sourcecode type="example">
HEADERS
  + END_STREAM
  + END_HEADERS
    :method = GET
    :scheme = http
    :authority = example.com
    :path = /.well-known/http-opportunistic

HEADERS
    :status = 200
    content-type = application/json
DATA
  + END_STREAM
[ "http://www.example.com", "http://example.com" ]
</sourcecode>
            </figure>
            <t>Though this document describes multiple origins, this is only for operational convenience. Only a request made to an origin (over an authenticated connection) can be used to acquire this resource for that origin. Thus in the example, the request to <spanx style="verb">http://example.com</spanx> cannot be assumed to also provide an http-opportunistic response for <spanx style="verb">http://www.example.com</spanx>.</t>
         </section>
         <section anchor="interaction-with-https-uris">
            <name>Interaction with "https" URIs</name>
            <t>Clients MUST NOT send <spanx style="verb">http</spanx> requests and <spanx style="verb">https</spanx> requests on the same connection. Similarly, clients MUST NOT send <spanx style="verb">http</spanx> requests for multiple origins on the same connection.</t>
         </section>
         <section anchor="well-known">
            <name>The "http-opportunistic" well-known URI</name>
            <t>This specification defines the "http-opportunistic" well-known URI <xref target="RFC5785"/>. A client is said to have a valid http-opportunistic response for a given origin when:</t>
            <t>
               <list style="symbols">
                  <t>The client has requested the well-known URI from the origin over an authenticated connection and a 200 (OK) response was provided, and</t>
                  <t>That response is fresh <xref target="RFC7234"/> (potentially through revalidation <xref target="RFC7232"/>), and</t>
                  <t>That response has the media type "application/json", and</t>
                  <t>That response's payload, when parsed as JSON <xref target="RFC7159"/>, contains an array as the root, and</t>
                  <t>The array contains a string that is a case-insensitive character-for-character match for the origin in question, serialised into Unicode as per <xref target="RFC6454" x:fmt="of" x:sec="6.1"/>.</t>
               </list>
            </t>
            <t>A client MAY treat an "http-opportunistic" resource as invalid if values it contains are not strings.</t>
            <t>This document does not define semantics for "http-opportunistic" resources on an <spanx style="verb">https</spanx> origin, nor does it define semantics if the resource includes <spanx style="verb">https</spanx> origins.</t>
            <t>Allowing clients to cache the http-opportunistic resource means that all alternative services need to be able to respond to requests for <spanx style="verb">http</spanx> resources. A client is permitted to use an alternative service without acquiring the http-opportunistic resource from that service.</t>
            <t>A client MUST NOT use any cached copies of an http-opportunistic resource that was acquired (or revalidated) over an unauthenticated connection. To avoid potential errors, a client can request or revalidate the http-opportunistic resource before using any connection to an alternative service.</t>
            <t>Clients that use cached http-opportunistic responses MUST ensure that their cache is cleared of any responses that were acquired over an unauthenticated connection. Revalidating an unauthenticated response using an authenticated connection does not ensure the integrity of the response.</t>
         </section>
      </section>
      <section anchor="iana-considerations">
         <name>IANA Considerations</name>
         <t>This specification registers a Well-Known URI <xref target="RFC5785"/>:</t>
         <t>
            <list style="symbols">
               <t>URI Suffix: http-opportunistic</t>
               <t>Change Controller: IETF</t>
               <t>Specification Document(s): <xref target="well-known"/> of [this specification]</t>
               <t>Related Information:</t>
            </list>
         </t>
      </section>
      <section anchor="security">
         <name>Security Considerations</name>
         <section anchor="security-indicators">
            <name>Security Indicators</name>
            <t>User Agents MUST NOT provide any special security indicators when an <spanx style="verb">http</spanx> resource is acquired using TLS. In particular, indicators that might suggest the same level of security as <spanx style="verb">https</spanx> MUST NOT be used (e.g., a "lock device").</t>
         </section>
         <section anchor="downgrade">
            <name>Downgrade Attacks</name>
            <t>A downgrade attack against the negotiation for TLS is possible.</t>
            <t>For example, because the <spanx style="verb">Alt-Svc</spanx> header field <xref target="RFC7838"/> likely appears in an unauthenticated and unencrypted channel, it is subject to downgrade by network attackers. In its simplest form, an attacker that wants the connection to remain in the clear need only strip the <spanx style="verb">Alt-Svc</spanx> header field from responses.</t>
         </section>
         <section anchor="privacy">
            <name>Privacy Considerations</name>
            <t>Cached alternative services can be used to track clients over time; e.g., using a user-specific hostname. Clearing the cache reduces the ability of servers to track clients; therefore clients MUST clear cached alternative service information when clearing other origin-based state (i.e., cookies).</t>
         </section>
         <section anchor="confuse">
            <name>Confusion Regarding Request Scheme</name>
            <t>HTTP implementations and applications sometimes use ambient signals to determine if a request is for an <spanx style="verb">https</spanx> resource; for example, they might look for TLS on the stack, or a server port number of 443.</t>
            <t>This might be due to expected limitations in the protocol (the most common HTTP/1.1 request form does not carry an explicit indication of the URI scheme and the resource might have been developed assuming HTTP/1.1), or it may be because how the server and application are implemented (often, they are two separate entities, with a variety of possible interfaces between them).</t>
            <t>Any security decisions based upon this information could be misled by the deployment of this specification, because it violates the assumption that the use of TLS (or port 443) means that the client is accessing a HTTPS URI, and operating in the security context implied by HTTPS.</t>
            <t>Therefore, server implementers and administrators need to carefully examine the use of such signals before deploying this specification.</t>
         </section>
         <section anchor="server-controls">
            <name>Server Controls</name>
            <t>This specification requires that a server send both an Alternative Service advertisement and host content in a well-known location to send HTTP requests over TLS. Servers SHOULD take suitable measures to ensure that the content of the well-known resource remains under their control. Likewise, because the Alt-Svc header field is used to describe policies across an entire origin, servers SHOULD NOT permit user content to set or modify the value of this header.</t>
         </section>
      </section>
   </middle>
   <back>
      <references title="Normative References">
         <reference anchor="RFC2119">
            <front>
               <title>Key words for use in RFCs to Indicate Requirement Levels</title>
               <author fullname="S. Bradner" initials="S." surname="Bradner"/>
               <date month="March" year="1997"/>
            </front>
            <seriesInfo name="BCP" value="14"/>
            <seriesInfo name="RFC" value="2119"/>
            <seriesInfo name="DOI" value="10.17487/RFC2119"/>
         </reference>
         <reference anchor="RFC2818">
            <front>
               <title>HTTP Over TLS</title>
               <author fullname="E. Rescorla" initials="E." surname="Rescorla"/>
               <date month="May" year="2000"/>
            </front>
            <seriesInfo name="RFC" value="2818"/>
            <seriesInfo name="DOI" value="10.17487/RFC2818"/>
         </reference>
         <reference anchor="RFC5246">
            <front>
               <title>The Transport Layer Security (TLS) Protocol Version 1.2</title>
               <author fullname="T. Dierks" initials="T." surname="Dierks"/>
               <author fullname="E. Rescorla" initials="E." surname="Rescorla"/>
               <date month="August" year="2008"/>
            </front>
            <seriesInfo name="RFC" value="5246"/>
            <seriesInfo name="DOI" value="10.17487/RFC5246"/>
         </reference>
         <reference anchor="RFC5785">
            <front>
               <title>Defining Well-Known Uniform Resource Identifiers (URIs)</title>
               <author fullname="M. Nottingham" initials="M." surname="Nottingham"/>
               <author fullname="E. Hammer-Lahav" initials="E." surname="Hammer-Lahav"/>
               <date month="April" year="2010"/>
            </front>
            <seriesInfo name="RFC" value="5785"/>
            <seriesInfo name="DOI" value="10.17487/RFC5785"/>
         </reference>
         <reference anchor="RFC6454">
            <front>
               <title>The Web Origin Concept</title>
               <author fullname="A. Barth" initials="A." surname="Barth"/>
               <date month="December" year="2011"/>
            </front>
            <seriesInfo name="RFC" value="6454"/>
            <seriesInfo name="DOI" value="10.17487/RFC6454"/>
         </reference>
         <reference anchor="RFC7159">
            <front>
               <title>The JavaScript Object Notation (JSON) Data Interchange Format</title>
               <author fullname="T. Bray" initials="T." role="editor" surname="Bray"/>
               <date month="March" year="2014"/>
            </front>
            <seriesInfo name="RFC" value="7159"/>
            <seriesInfo name="DOI" value="10.17487/RFC7159"/>
         </reference>
         <reference anchor="RFC7230">
            <front>
               <title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
               <author fullname="R. Fielding"
                        initials="R."
                        role="editor"
                        surname="Fielding"/>
               <author fullname="J. Reschke"
                        initials="J."
                        role="editor"
                        surname="Reschke"/>
               <date month="June" year="2014"/>
            </front>
            <seriesInfo name="RFC" value="7230"/>
            <seriesInfo name="DOI" value="10.17487/RFC7230"/>
         </reference>
         <reference anchor="RFC7232">
            <front>
               <title>Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</title>
               <author fullname="R. Fielding"
                        initials="R."
                        role="editor"
                        surname="Fielding"/>
               <author fullname="J. Reschke"
                        initials="J."
                        role="editor"
                        surname="Reschke"/>
               <date month="June" year="2014"/>
            </front>
            <seriesInfo name="RFC" value="7232"/>
            <seriesInfo name="DOI" value="10.17487/RFC7232"/>
         </reference>
         <reference anchor="RFC7234">
            <front>
               <title>Hypertext Transfer Protocol (HTTP/1.1): Caching</title>
               <author fullname="R. Fielding"
                        initials="R."
                        role="editor"
                        surname="Fielding"/>
               <author fullname="M. Nottingham"
                        initials="M."
                        role="editor"
                        surname="Nottingham"/>
               <author fullname="J. Reschke"
                        initials="J."
                        role="editor"
                        surname="Reschke"/>
               <date month="June" year="2014"/>
            </front>
            <seriesInfo name="RFC" value="7234"/>
            <seriesInfo name="DOI" value="10.17487/RFC7234"/>
         </reference>
         <reference anchor="RFC7540">
            <front>
               <title>Hypertext Transfer Protocol Version 2 (HTTP/2)</title>
               <author fullname="M. Belshe" initials="M." surname="Belshe"/>
               <author fullname="R. Peon" initials="R." surname="Peon"/>
               <author fullname="M. Thomson"
                        initials="M."
                        role="editor"
                        surname="Thomson"/>
               <date month="May" year="2015"/>
            </front>
            <seriesInfo name="RFC" value="7540"/>
            <seriesInfo name="DOI" value="10.17487/RFC7540"/>
         </reference>
         <reference anchor="RFC7838">
            <front>
               <title>HTTP Alternative Services</title>
               <author fullname="M. Nottingham" initials="M." surname="Nottingham"/>
               <author fullname="P. McManus" initials="P." surname="McManus"/>
               <author fullname="J. Reschke" initials="J." surname="Reschke"/>
               <date month="April" year="2016"/>
            </front>
            <seriesInfo name="RFC" value="7838"/>
            <seriesInfo name="DOI" value="10.17487/RFC7838"/>
         </reference>
      </references>
      <references title="Informative References">
         <reference anchor="RFC7258">
            <front>
               <title>Pervasive Monitoring Is an Attack</title>
               <author fullname="S. Farrell" initials="S." surname="Farrell"/>
               <author fullname="H. Tschofenig" initials="H." surname="Tschofenig"/>
               <date month="May" year="2014"/>
            </front>
            <seriesInfo name="BCP" value="188"/>
            <seriesInfo name="RFC" value="7258"/>
            <seriesInfo name="DOI" value="10.17487/RFC7258"/>
         </reference>
         <reference anchor="RFC7435">
            <front>
               <title>Opportunistic Security: Some Protection Most of the Time</title>
               <author fullname="V. Dukhovni" initials="V." surname="Dukhovni"/>
               <date month="December" year="2014"/>
            </front>
            <seriesInfo name="RFC" value="7435"/>
            <seriesInfo name="DOI" value="10.17487/RFC7435"/>
         </reference>
         <reference anchor="RFC7469">
            <front>
               <title>Public Key Pinning Extension for HTTP</title>
               <author fullname="C. Evans" initials="C." surname="Evans"/>
               <author fullname="C. Palmer" initials="C." surname="Palmer"/>
               <author fullname="R. Sleevi" initials="R." surname="Sleevi"/>
               <date month="April" year="2015"/>
            </front>
            <seriesInfo name="RFC" value="7469"/>
            <seriesInfo name="DOI" value="10.17487/RFC7469"/>
         </reference>
         <reference anchor="W3C.CR-mixed-content-20160802"
                     target="https://www.w3.org/TR/2016/CR-mixed-content-20160802/">
            <front>
               <title>Mixed Content</title>
               <author fullname="Mike West" role="editor"/>
               <date day="2" month="August" year="2016"/>
            </front>
            <seriesInfo name="W3C CR" value="CR-mixed-content-20160802"/>
            <seriesInfo name="W3C" value="CR-mixed-content-20160802"/>
         </reference>
      </references>
      <section anchor="acknowledgements">
         <name>Acknowledgements</name>
         <t>Mike Bishop contributed significant text to this document.</t>
         <t>Thanks to Patrick McManus, Stefan Eissing, Eliot Lear, Stephen Farrell, Guy Podjarny, Stephen Ludin, Erik Nygren, Paul Hoffman, Adam Langley, Eric Rescorla, Julian Reschke, Kari Hurtta, and Richard Barnes for their feedback and suggestions.</t>
      </section>
   </back>
</rfc>
