<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-ietf-httpbis-client-cert-field-06" number="9440" submissionType="IETF" category="info" consensus="true" tocInclude="true" sortRefs="true" symRefs="true" xml:lang="en" updates="" obsoletes="" version="3">

  <front>
    <title abbrev="Client-Cert Header">Client-Cert HTTP Header Field</title>
    <seriesInfo name="RFC" value="9440"/>
    <author initials="B." surname="Campbell" fullname="Brian Campbell">
      <organization>Ping Identity</organization>
      <address>
        <email>bcampbell@pingidentity.com</email>
      </address>
    </author>
    <author initials="M." surname="Bishop" fullname="Mike Bishop" role="editor">
      <organization>Akamai</organization>
      <address>
        <email>mbishop@evequefou.be</email>
      </address>
    </author>
    <date year="2023" month="July" />
    <area>art</area>
    <workgroup>httpbis</workgroup>
    <keyword>http</keyword>
    <keyword>client certificate</keyword>

    <abstract>
      <t>This document describes HTTP extension header fields that allow a TLS
      terminating reverse proxy (TTRP) to convey the client certificate
      information of a mutually authenticated TLS connection to the origin
      server in a common and predictable manner.</t>
    </abstract>

  </front>
  <middle>
    <section anchor="Introduction">
      <name>Introduction</name>
      <t>A fairly common deployment pattern for HTTPS applications is to have the origin
HTTP application servers sit behind a reverse proxy that terminates TLS
connections from clients. The proxy is accessible to the Internet and dispatches
client requests to the appropriate origin server within a private or protected
network. The origin servers are not directly accessible by clients and are only
reachable through the reverse proxy. The backend details of this type of
deployment are typically opaque to clients who make requests to the proxy server
and see responses as though they originated from the proxy server itself.
Although HTTPS is also usually employed between the proxy and the origin server,
the TLS connection that the client establishes for HTTPS is only between itself
and the reverse proxy server.</t>

      <t>The deployment pattern is found in a number of varieties such as n-tier
architectures, content delivery networks, application load-balancing services,
and ingress controllers.</t>
      <t>Although not exceedingly prevalent, TLS client certificate
      authentication is sometimes employed, and in such cases the origin
      server often requires information about the client certificate for its
      application logic. Such logic might include access control decisions,
      audit logging, and binding issued tokens or cookies to a certificate, including
      the respective validation of such bindings. The specific details
      needed from the certificate also vary with the application
      requirements. In order for these types of application deployments to
      work in practice, the reverse proxy needs to convey information about
      the client certificate to the origin application server. At the time of
      writing, a common way this information is conveyed is by using
      non-standard fields to carry the certificate (in some encoding) or
      individual parts thereof in the HTTP request that is dispatched to the
      origin server. This solution works, but interoperability between
      independently developed components can be cumbersome or even impossible
      depending on the implementation choices respectively made (like what
      field names are used or are configurable, which parts of the certificate
      are exposed, or how the certificate is encoded). A well-known
      predictable approach to this commonly occurring functionality could
      improve and simplify interoperability between independent
      implementations.</t>


      <t>The scope of this document is to describe existing practice while
      codifying specific details sufficient to facilitate improved and
      lower-touch interoperability.  As such, this document describes two HTTP
      header fields, "Client-Cert" and "Client-Cert-Chain",
      which a TLS terminating reverse proxy (TTRP) adds to requests sent to
      the backend origin servers. The Client-Cert field value
      contains the end-entity client certificate from the mutually
      authenticated TLS connection between the originating client and the
      TTRP. Optionally, the Client-Cert-Chain field value contains
      the certificate chain used for validation of the end-entity
      certificate. This enables the backend origin server to utilize the
      client certificate information in its application logic. While there may
      be additional proxies or hops between the TTRP and the origin server
      (potentially even with mutually authenticated TLS connections between
      them), the scope of the Client-Cert header field is
      intentionally limited to exposing to the origin server the certificate
      that was presented by the originating client in its connection to the
      TTRP.</t>
      <section anchor="requirements-notation-and-conventions">
        <name>Requirements Notation and Conventions</name>
        <t>
    The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
    NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT 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="terminology-and-applicability">
        <name>Terminology and Applicability</name>
	<t>This document uses the following terminology from <xref section="3" sectionFormat="of"
        target="RFC8941"/> to specify syntax and parsing: List
        and Byte Sequence.</t>
        <t>Phrases like "TLS client certificate authentication" or "mutually
        authenticated TLS" are used throughout this document to refer to the
        process whereby, in addition to the normal TLS server authentication
        with a certificate, a client presents its X.509 certificate <xref
        target="RFC5280"/> and proves possession of the corresponding private
        key to a server when negotiating a TLS connection or the resumption of
        such a connection.
	In contemporary versions of TLS <xref
        target="RFC8446"/> <xref target="RFC5246"/>, mutual authentication requires the client to send
        the Certificate and CertificateVerify messages during the handshake
        and the server to verify the CertificateVerify and Finished
        messages.</t>
        <t>HTTP/2 restricts TLS 1.2 renegotiation (<xref section="9.2.1"
        sectionFormat="of" target="RFC9113"/>) and prohibits TLS 1.3
        post-handshake authentication (<xref section="9.2.3"
        sectionFormat="of" target="RFC9113"/>). However, they are sometimes
        used to implement reactive client certificate authentication in
        HTTP/1.1 <xref target="RFC9112"/> where the server decides whether to
        request a client certificate based on the HTTP request. HTTP
        application data sent on such a connection after receipt and
        verification of the client certificate is also mutually authenticated
        and thus suitable for the mechanisms described in this
        document. With post-handshake authentication, there is also the
        possibility, though unlikely in practice, of multiple certificates and
        certificate chains from the client on a connection. In this case, only
        the certificate and chain of the last post-handshake authentication
        are to be utilized for the header fields described herein.</t>
      </section>
    </section>
    <section anchor="headers">
      <name>HTTP Header Fields and Processing Rules</name>
      <t>This document designates the following headers, defined further in
      Sections <xref target="header" format="counter"/> and <xref target="chain-header" format="counter"/>, respectively,
      to carry the client certificate information of a mutually authenticated
      TLS connection. The headers convey the information from the reverse
      proxy to the origin server.</t>
      <dl spacing="normal" newline="true">
        <dt>Client-Cert:</dt>
        <dd>The end-entity certificate used by the client in the TLS handshake
        with the reverse proxy. </dd>
        <dt>Client-Cert-Chain:</dt>
        <dd>The certificate chain used for validation of the end-entity
        certificate provided by the client in the TLS handshake with the
        reverse proxy.</dd>
      </dl>
      <section anchor="encoding">
        <name>Encoding</name>
        <t>The headers in this document encode certificates as Byte Sequences
        (<xref section="3.3.5" sectionFormat="of" target="RFC8941"/>) where
        the value of the binary data is a DER-encoded <xref
        target="ITU.X690"/> X.509 certificate <xref target="RFC5280"/>.
        In effect, this means that the binary DER certificate is encoded using
        base64 (without line breaks, spaces, or other characters outside the
        base64 alphabet) and delimited with colons on either side.</t>
	
        <t>Note that certificates are often stored in an encoded textual
        format, such as the one described in <xref section="5.1"
        sectionFormat="of" target="RFC7468"/>, which is already nearly
        compatible with a Byte Sequence. If certificates are encoded as such, it will be sufficient to
        replace "---(BEGIN|END) CERTIFICATE---" with ":" and
        remove line breaks in order to generate an appropriate item.</t>
      </section>
      <section anchor="header">
        <name>Client-Cert HTTP Header Field</name>
        <t>In the context of a TLS terminating reverse proxy deployment, the
        proxy makes the TLS client certificate available to the backend
        application with the Client-Cert HTTP header field. This field
        contains the end-entity certificate used by the client in the TLS
        handshake.</t>
        <t>Client-Cert is a Byte Sequence with the value of the header
        encoded as described in <xref target="encoding"/>.</t>
        <t>The Client-Cert header field is only for use in HTTP
        requests and <bcp14>MUST NOT</bcp14> be used in HTTP responses.  It is
        a singleton header field value as defined in <xref section="5.5"
        sectionFormat="of" target="RFC9110"/>, which <bcp14>MUST NOT</bcp14>
        have a list of values or occur multiple times in a request.</t>
        <t><xref target="example-header"/> in <xref target="example"/> has an example of the Client-Cert header field.</t>
      </section>
      <section anchor="chain-header">
        <name>Client-Cert-Chain HTTP Header Field</name>
        <t>In the context of a TLS terminating reverse proxy deployment, the proxy
<bcp14>MAY</bcp14> make the certificate chain
available to the backend application with the Client-Cert-Chain HTTP header
field.</t>
<t>Client-Cert-Chain is a List (<xref section="3.1" sectionFormat="of" target="RFC8941"/>). Each item in the
List <bcp14>MUST</bcp14> be a Byte Sequence encoded as described in <xref target="encoding"/>. The order
is the same as the ordering in TLS (as described in <xref section="4.4.2" sectionFormat="of" target="RFC8446"/>).</t>
        <t>Client-Cert-Chain <bcp14>MUST NOT</bcp14> appear unless Client-Cert is also present, and it does
not itself include the end-entity certificate that is already present in Client-Cert.
The root certificate <bcp14>MAY</bcp14> be omitted from Client-Cert-Chain, provided that the target
origin server is known to possess the omitted trust anchor.</t>
        <t>The Client-Cert-Chain header field is only for use in HTTP requests and <bcp14>MUST
NOT</bcp14> be used in HTTP responses.  It <bcp14>MAY</bcp14> have a list of values or occur multiple
times in a request.  For header compression purposes, it might be advantageous
to split lists into multiple instances.</t>
        <t><xref target="example-chain-header"/> in <xref target="example"/> has an example of the Client-Cert-Chain header field.</t>
      </section>
      <section anchor="processing-rules">
        <name>Processing Rules</name>
        <t>This section outlines the applicable processing rules for a TTRP
        that has negotiated a mutually authenticated TLS connection to convey
        the client certificate from that connection to the backend origin
        servers. This technique is to be used as a configuration or deployment
        option, and the processing rules described herein are for servers
        operating with that option enabled.</t>
        <t>A TTRP negotiates the use of a mutually authenticated TLS
        connection with the client, such as is described in <xref
        target="RFC8446"/> or <xref target="RFC5246"/>, and validates the
        client certificate per its policy and trusted certificate authorities.
        Each HTTP request on the underlying TLS connection is dispatched to
        the origin server with the following modifications:</t>
	
	<ol spacing="normal" type="1">
	  <li>The client certificate is placed in the Client-Cert
	  header field of the dispatched request, as described in <xref
	  target="header"/>.</li>
          <li>If so configured, the validation chain of the client certificate
          is placed in the Client-Cert-Chain header field of the
          request, as described in <xref target="chain-header"/>.</li>
          <li>Any occurrence of the Client-Cert or
          Client-Cert-Chain header fields in the original incoming
          request <bcp14>MUST</bcp14> be removed or overwritten before
          forwarding the request. An incoming request that has a
          Client-Cert or Client-Cert-Chain header field
          <bcp14>MAY</bcp14> be rejected with an HTTP 400 response.</li>
        </ol>

        <t>Requests to the TTRP made over a TLS connection where the use of client certificate
authentication was not negotiated <bcp14>MUST</bcp14> be sanitized by removing any and all
occurrences of the Client-Cert and Client-Cert-Chain header fields prior to
dispatching the request to the backend server.</t>
<t>Backend origin servers may then use the Client-Cert header
        field of the request to determine if the connection from the client to
        the TTRP was mutually authenticated and, if so, the certificate
        thereby presented by the client.  Access control decisions based on
        the client certificate (or lack thereof) can be conveyed by selecting
        response content as appropriate or with an HTTP 403 response, if the
        certificate is deemed unacceptable for the given context.  Note that
        TLS clients that rely on error indications at the TLS layer for an
        unacceptable certificate will not receive those signals.</t>
        <t>When the value of the Client-Cert request header field is
        used to select a response (e.g., the response content is
        access-controlled), the response <bcp14>MUST</bcp14> either be
        uncacheable (e.g., by sending Cache-Control: no-store) or be
        designated for selective reuse only for subsequent requests with the
        same Client-Cert header field value by sending a "Vary:
        Client-Cert" response header.  If a TTRP encounters a response
        with Client-Cert or Client-Cert-Chain in the Vary header
        field (<xref section="12.5.5" sectionFormat="of"
        target="RFC9110"/>), it <bcp14>SHOULD</bcp14> prevent the user agent from caching
        the response by transforming the value of the Vary response
        header field to "*".</t>
        <t>Forward proxies and other intermediaries <bcp14>MUST NOT</bcp14>
        add the Client-Cert or Client-Cert-Chain header
        fields to requests or modify an existing Client-Cert or
        Client-Cert-Chain header field. Similarly, clients
        <bcp14>MUST NOT</bcp14> employ the Client-Cert or
        Client-Cert-Chain header field in requests.</t>
      </section>
    </section>
    <section anchor="deployment">
      <name>Deployment Considerations</name>
      <section anchor="header-field-compression">
        <name>Header Field Compression</name>	
        <t>If the connection between the TTRP and origin is capable of field
        compression (e.g., HPACK <xref target="RFC7541"/>
        or QPACK <xref target="RFC9204"/>), and the TTRP
        multiplexes more than one client's requests into that connection, the
        size and variation of Client-Cert and
        Client-Cert-Chain field values can reduce compression
        efficiency significantly.  An origin could mitigate the efficiency
        loss by increasing the size of the dynamic table.  If the TTRP
        determines that the origin dynamic table is not sufficiently large, it
        may find it beneficial to always send the field value as a literal
        rather than entering it into the table.</t>
      </section>
      <section anchor="message-header-size">
        <name>Message Header Size</name>
        <t>A server in receipt of a larger message header than it is willing
        to handle can send an HTTP 431 (Request Header Fields Too Large)
        status code per <xref section="5" sectionFormat="of"
        target="RFC6585"/>.  Due to the typical size of the field values
        containing certificate data, recipients may need to be configured to
        allow for a larger maximum header size.  An intermediary generating
        client certificate header fields on connections that allow for
        advertising the maximum acceptable header size (e.g., HTTP/2 <xref
        target="RFC9113"/> or HTTP/3 <xref target="RFC9114"/>) should account for the additional size of
        the header of the requests it sends, versus the requests it receives,
        by advertising a value to its clients that is sufficiently smaller so
        as to allow for the addition of certificate data.</t>
      </section>
      <section anchor="tls-session-resumption">
        <name>TLS Session Resumption</name>
        <t>Some TLS implementations do not retain client certificate
        information when resuming.  Providing inconsistent values of
        Client-Cert and Client-Cert-Chain when resuming might lead to errors,
        so implementations that are unable to provide these values
        <bcp14>SHOULD</bcp14> either disable resumption for connections with
        client certificates or initially omit a Client-Cert or
        Client-Cert-Chain field if it might not be available after
        resuming.</t>
      </section>
    </section>

    <section anchor="sec">
      <name>Security Considerations</name>
      <t>The header fields described herein enable a TTRP and backend or
      origin server to function together as though, from the client's
      perspective, they are a single logical server-side deployment of HTTPS
      over a mutually authenticated TLS connection. However, use of the header
      fields outside that intended use case may undermine the protections
      afforded by TLS client certificate authentication. Therefore, steps such
      as those described below need to be taken to prevent unintended use,
      both in sending the header field and in relying on its value.</t>
      <t>Producing and consuming the Client-Cert and Client-Cert-Chain header
fields <bcp14>SHOULD</bcp14> be configurable
options, respectively, in a TTRP and backend server (or in an individual application in
that server). The default configuration for both should be to not use the
header fields, thus requiring an "opt-in" to the functionality.</t>
      <t>In order to prevent field injection, backend servers <bcp14>MUST</bcp14> only accept the
Client-Cert and Client-Cert-Chain header fields from a trusted
TTRP (or other proxy in a trusted path
from the TTRP). A TTRP <bcp14>MUST</bcp14> sanitize the incoming request before forwarding it
on by removing or overwriting any existing instances of the fields. Otherwise,
arbitrary clients can control the field values as seen and used by the backend
server. It is important to note that neglecting to prevent field injection does
not "fail safe" in that the nominal functionality will still work as expected
even when malicious actions are possible. As such, extra care is recommended in
ensuring that proper field sanitation is in place.</t>
      <t>The communication between a TTRP and backend server needs to be secured against
      eavesdropping and modification by unintended parties.</t>
      <t>The configuration options and request sanitization are necessary functionalities
of the respective servers. The other requirements can be met in a number of
ways, which will vary based on specific deployments. The communication between a
TTRP and backend or origin server, for example, might be authenticated in some
way with the insertion and consumption of the Client-Cert
and Client-Cert-Chain header fields occurring
only on that connection.
<xref section="B.3" sectionFormat="of" target="I-D.ietf-httpbis-message-signatures"/> gives one example of
this with an application of HTTP Message Signatures.
Alternatively, the network topology might dictate a
private network such that the backend application is only able to accept
requests from the TTRP and the proxy can only make requests to that server.
Other deployments that meet the requirements set forth herein are also possible.</t>
    </section>
 <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <section anchor="http-field-name-registrations">
        <name>HTTP Field Name Registrations</name>
        <t>IANA has registered the following entries in the "Hypertext Transfer
        Protocol (HTTP) Field Name Registry" defined by "HTTP Semantics" <xref
        target="RFC9110"/>:</t>

<table anchor="table_1">
  <name>Hypertext Transfer Protocol (HTTP) Field Name Registry</name>
  <thead>
    <tr>
      <th>Field Name</th> 
      <th>Status</th>
      <th>Reference</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Client-Cert</td>
      <td>permanent</td>
      <td>RFC 9440, <xref target="headers"/></td>
    </tr>
    <tr>
      <td>Client-Cert-Chain</td>
      <td>permanent</td>
      <td>RFC 9440, <xref target="headers"/></td>
    </tr>
  </tbody>
</table>
      </section>
    </section>
  </middle>
  <back>
    
    <displayreference target="RFC8941" to="STRUCTURED-FIELDS"/>
    <displayreference target="RFC9110" to="HTTP"/>
    <displayreference target="RFC9112" to="HTTP/1.1"/>
    <displayreference target="RFC9113" to="HTTP/2"/>
    <displayreference target="RFC9114" to="HTTP/3"/>
    <displayreference target="I-D.ietf-httpbis-message-signatures" to="HTTPSIG"/>
    <displayreference target="RFC8446" to="TLS"/>
    <displayreference target="RFC9204" to="QPACK"/>
    <displayreference target="RFC7541" to="HPACK"/>
    <displayreference target="RFC5246" to="TLS1.2"/>
    
 <references>
      <name>References</name>
      <references>
        <name>Normative References</name>

<!--[RFC8941] [STRUCTURED-FIELDS] updated to long version because xi:include shows Kamp's name as "P. Kamp" instead of "P-H. Kamp"-->
<reference anchor="RFC8941" target="https://www.rfc-editor.org/info/rfc8941">
<front>
<title>Structured Field Values for HTTP</title>
<author fullname="M. Nottingham" initials="M." surname="Nottingham"/>
<author fullname="P-H. Kamp" initials="P-H." surname="Kamp"/>
<date month="February" year="2021"/>
</front>
<seriesInfo name="RFC" value="8941"/>
<seriesInfo name="DOI" value="10.17487/RFC8941"/>
</reference>

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

        <reference anchor="ITU.X690" target="https://www.itu.int/rec/T-REC-X.690/en">
          <front>
            <title>Information technology - ASN.1 encoding rules:
            Specification of Basic Encoding Rules (BER), Canonical Encoding
            Rules (CER) and Distinguished Encoding Rules (DER)</title>
            <author>
              <organization>ITU-T</organization>
            </author>
            <date month="February" year="2021"/>
          </front>
	  <seriesInfo name="ITU-T Recommendation" value="X.690"/>
        </reference>
      </references>
      <references>

        <name>Informative References</name>

<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9112.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9113.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9114.xml"/>

<!-- [I-D.ietf-httpbis-message-signatures] IESG Evaluation::Revised I-D Needed as of 7/21/23. Updated to long version because missing editor roles for Backman and Richer. -->
<reference anchor="I-D.ietf-httpbis-message-signatures">
<front>
<title>HTTP Message Signatures</title>
<author initials="A." surname="Backman" fullname="Annabelle Backman" role="editor">
<organization>Amazon</organization>
</author>
<author initials="J." surname="Richer" fullname="Justin Richer" role="editor">
<organization>Bespoke Engineering</organization>
</author>
<author initials="M." surname="Sporny" fullname="Manu Sporny">
<organization>Digital Bazaar</organization>
</author>
<date month="May" day="2" year="2023"/>
</front>
<seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-message-signatures-17"/>
</reference>

<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5246.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7468.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7541.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9204.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6585.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7239.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8705.xml"/>

      </references>
    </references>

    <section anchor="example">
      <name>Example</name> <t>In a hypothetical example where a TLS client
      would present the client and intermediate certificate from <xref
      target="example-chain"/> when establishing a mutually authenticated TLS
      connection with the TTRP, the proxy would send the Client-Cert
      field shown in <xref target="example-header"/> to the backend. Note that
      line breaks and extra spaces have been added to the field value in Figures <xref
      target="example-header" format="counter"/> and <xref target="example-chain-header" format="counter"/> for
      display and formatting purposes only.</t>

      <figure anchor="example-chain">
        <name>Certificate Chain (with Client Certificate First)</name>
        <sourcecode><![CDATA[
-----BEGIN CERTIFICATE-----
MIIBqDCCAU6gAwIBAgIBBzAKBggqhkjOPQQDAjA6MRswGQYDVQQKDBJMZXQncyBB
dXRoZW50aWNhdGUxGzAZBgNVBAMMEkxBIEludGVybWVkaWF0ZSBDQTAeFw0yMDAx
MTQyMjU1MzNaFw0yMTAxMjMyMjU1MzNaMA0xCzAJBgNVBAMMAkJDMFkwEwYHKoZI
zj0CAQYIKoZIzj0DAQcDQgAE8YnXXfaUgmnMtOXU/IncWalRhebrXmckC8vdgJ1p
5Be5F/3YC8OthxM4+k1M6aEAEFcGzkJiNy6J84y7uzo9M6NyMHAwCQYDVR0TBAIw
ADAfBgNVHSMEGDAWgBRm3WjLa38lbEYCuiCPct0ZaSED2DAOBgNVHQ8BAf8EBAMC
BsAwEwYDVR0lBAwwCgYIKwYBBQUHAwIwHQYDVR0RAQH/BBMwEYEPYmRjQGV4YW1w
bGUuY29tMAoGCCqGSM49BAMCA0gAMEUCIBHda/r1vaL6G3VliL4/Di6YK0Q6bMje
SkC3dFCOOB8TAiEAx/kHSB4urmiZ0NX5r5XarmPk0wmuydBVoU4hBVZ1yhk=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB5jCCAYugAwIBAgIBFjAKBggqhkjOPQQDAjBWMQswCQYDVQQGEwJVUzEbMBkG
A1UECgwSTGV0J3MgQXV0aGVudGljYXRlMSowKAYDVQQDDCFMZXQncyBBdXRoZW50
aWNhdGUgUm9vdCBBdXRob3JpdHkwHhcNMjAwMTE0MjEzMjMwWhcNMzAwMTExMjEz
MjMwWjA6MRswGQYDVQQKDBJMZXQncyBBdXRoZW50aWNhdGUxGzAZBgNVBAMMEkxB
IEludGVybWVkaWF0ZSBDQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJf+aA54
RC5pyLAR5yfXVYmNpgd+CGUTDp2KOGhc0gK91zxhHesEYkdXkpS2UN8Kati+yHtW
CV3kkhCngGyv7RqjZjBkMB0GA1UdDgQWBBRm3WjLa38lbEYCuiCPct0ZaSED2DAf
BgNVHSMEGDAWgBTEA2Q6eecKu9g9yb5glbkhhVINGDASBgNVHRMBAf8ECDAGAQH/
AgEAMA4GA1UdDwEB/wQEAwIBhjAKBggqhkjOPQQDAgNJADBGAiEA5pLvaFwRRkxo
mIAtDIwg9D7gC1xzxBl4r28EzmSO1pcCIQCJUShpSXO9HDIQMUgH69fNDEMHXD3R
RX5gP7kuu2KGMg==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICBjCCAaygAwIBAgIJAKS0yiqKtlhoMAoGCCqGSM49BAMCMFYxCzAJBgNVBAYT
AlVTMRswGQYDVQQKDBJMZXQncyBBdXRoZW50aWNhdGUxKjAoBgNVBAMMIUxldCdz
IEF1dGhlbnRpY2F0ZSBSb290IEF1dGhvcml0eTAeFw0yMDAxMTQyMTI1NDVaFw00
MDAxMDkyMTI1NDVaMFYxCzAJBgNVBAYTAlVTMRswGQYDVQQKDBJMZXQncyBBdXRo
ZW50aWNhdGUxKjAoBgNVBAMMIUxldCdzIEF1dGhlbnRpY2F0ZSBSb290IEF1dGhv
cml0eTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABFoaHU+Z5bPKmGzlYXtCf+E6
HYj62fORaHDOrt+yyh3H/rTcs7ynFfGn+gyFsrSP3Ez88rajv+U2NfD0o0uZ4Pmj
YzBhMB0GA1UdDgQWBBTEA2Q6eecKu9g9yb5glbkhhVINGDAfBgNVHSMEGDAWgBTE
A2Q6eecKu9g9yb5glbkhhVINGDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE
AwIBhjAKBggqhkjOPQQDAgNIADBFAiEAmAeg1ycKHriqHnaD4M/UDBpQRpkmdcRF
YGMg1Qyrkx4CIB4ivz3wQcQkGhcsUZ1SOImd/lq1Q0FLf09rGfLQPWDc
-----END CERTIFICATE-----
]]></sourcecode>
      </figure>

      <figure anchor="example-header">
        <name>Header Field in HTTP Request to Origin Server</name>
        <sourcecode><![CDATA[
Client-Cert: :MIIBqDCCAU6gAwIBAgIBBzAKBggqhkjOPQQDAjA6MRswGQYDVQQKDBJ
 MZXQncyBBdXRoZW50aWNhdGUxGzAZBgNVBAMMEkxBIEludGVybWVkaWF0ZSBDQTAeFw0
 yMDAxMTQyMjU1MzNaFw0yMTAxMjMyMjU1MzNaMA0xCzAJBgNVBAMMAkJDMFkwEwYHKoZ
 Izj0CAQYIKoZIzj0DAQcDQgAE8YnXXfaUgmnMtOXU/IncWalRhebrXmckC8vdgJ1p5Be
 5F/3YC8OthxM4+k1M6aEAEFcGzkJiNy6J84y7uzo9M6NyMHAwCQYDVR0TBAIwADAfBgN
 VHSMEGDAWgBRm3WjLa38lbEYCuiCPct0ZaSED2DAOBgNVHQ8BAf8EBAMCBsAwEwYDVR0
 lBAwwCgYIKwYBBQUHAwIwHQYDVR0RAQH/BBMwEYEPYmRjQGV4YW1wbGUuY29tMAoGCCq
 GSM49BAMCA0gAMEUCIBHda/r1vaL6G3VliL4/Di6YK0Q6bMjeSkC3dFCOOB8TAiEAx/k
 HSB4urmiZ0NX5r5XarmPk0wmuydBVoU4hBVZ1yhk=:
]]></sourcecode>
      </figure>

      <t>If the proxy were configured to also include the certificate chain, it would
also include the Client-Cert-Chain header field. Note that while
the following example does illustrate the TTRP inserting the root certificate,
many deployments will opt to omit the trust anchor.</t>


      <figure anchor="example-chain-header">
        <name>Certificate Chain in HTTP Request to Origin Server</name>
        <sourcecode><![CDATA[
Client-Cert-Chain: :MIIB5jCCAYugAwIBAgIBFjAKBggqhkjOPQQDAjBWMQsw
 CQYDVQQGEwJVUzEbMBkGA1UECgwSTGV0J3MgQXV0aGVudGljYXRlMSowKAYDVQQ
 DDCFMZXQncyBBdXRoZW50aWNhdGUgUm9vdCBBdXRob3JpdHkwHhcNMjAwMTE0Mj
 EzMjMwWhcNMzAwMTExMjEzMjMwWjA6MRswGQYDVQQKDBJMZXQncyBBdXRoZW50a
 WNhdGUxGzAZBgNVBAMMEkxBIEludGVybWVkaWF0ZSBDQTBZMBMGByqGSM49AgEG
 CCqGSM49AwEHA0IABJf+aA54RC5pyLAR5yfXVYmNpgd+CGUTDp2KOGhc0gK91zx
 hHesEYkdXkpS2UN8Kati+yHtWCV3kkhCngGyv7RqjZjBkMB0GA1UdDgQWBBRm3W
 jLa38lbEYCuiCPct0ZaSED2DAfBgNVHSMEGDAWgBTEA2Q6eecKu9g9yb5glbkhh
 VINGDASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBhjAKBggqhkjO
 PQQDAgNJADBGAiEA5pLvaFwRRkxomIAtDIwg9D7gC1xzxBl4r28EzmSO1pcCIQC
 JUShpSXO9HDIQMUgH69fNDEMHXD3RRX5gP7kuu2KGMg==:, :MIICBjCCAaygAw
 IBAgIJAKS0yiqKtlhoMAoGCCqGSM49BAMCMFYxCzAJBgNVBAYTAlVTMRswGQYDV
 QQKDBJMZXQncyBBdXRoZW50aWNhdGUxKjAoBgNVBAMMIUxldCdzIEF1dGhlbnRp
 Y2F0ZSBSb290IEF1dGhvcml0eTAeFw0yMDAxMTQyMTI1NDVaFw00MDAxMDkyMTI
 1NDVaMFYxCzAJBgNVBAYTAlVTMRswGQYDVQQKDBJMZXQncyBBdXRoZW50aWNhdG
 UxKjAoBgNVBAMMIUxldCdzIEF1dGhlbnRpY2F0ZSBSb290IEF1dGhvcml0eTBZM
 BMGByqGSM49AgEGCCqGSM49AwEHA0IABFoaHU+Z5bPKmGzlYXtCf+E6HYj62fOR
 aHDOrt+yyh3H/rTcs7ynFfGn+gyFsrSP3Ez88rajv+U2NfD0o0uZ4PmjYzBhMB0
 GA1UdDgQWBBTEA2Q6eecKu9g9yb5glbkhhVINGDAfBgNVHSMEGDAWgBTEA2Q6ee
 cKu9g9yb5glbkhhVINGDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBh
 jAKBggqhkjOPQQDAgNIADBFAiEAmAeg1ycKHriqHnaD4M/UDBpQRpkmdcRFYGMg
 1Qyrkx4CIB4ivz3wQcQkGhcsUZ1SOImd/lq1Q0FLf09rGfLQPWDc:
]]></sourcecode>
      </figure>

    </section>
    <section anchor="select-design-considerations">
      <name>Select Design Considerations</name>
      <section anchor="field-injection">
        <name>Field Injection</name>
        <t>This document requires that the TTRP sanitize the fields of the incoming request by
removing or overwriting any existing instances of the Client-Cert
and Client-Cert-Chain header fields
before dispatching that request to the backend application. Otherwise, a client
could inject its own values that would appear to the backend to
have come from the TTRP. Although numerous other methods of detecting and preventing
field injection are possible, such as the use of a unique secret value as part
of the field name or value or the application of a signature, HMAC, or AEAD,
there is no common general mechanism. The potential problem of
client field injection is not at all unique to the functionality of this document;
therefore, it would be inappropriate for this document to define a one-off
solution. Since a generic common solution does not currently exist,
stripping and sanitizing the fields is the de facto means of protecting against
field injection in practice. Sanitizing the fields is sufficient when
properly implemented and is a normative requirement of <xref target="sec"/>.</t>
      </section>
      <section anchor="the-forwarded-http-extension">
        <name>The Forwarded HTTP Extension</name>
        <t>The Forwarded HTTP header field defined in <xref
        target="RFC7239"/> allows proxy components to disclose information
        lost in the proxying process. The TLS client certificate information
        of concern to this document could have been communicated with an
        extension parameter to the Forwarded field; however, doing so
        would have had some disadvantages that this document endeavored to
        avoid. The Forwarded field syntax allows for information
        about a full chain of proxied HTTP requests, whereas the
        Client-Cert and Client-Cert-Chain header fields of
        this document are concerned only with conveying information about the
        certificate presented by the originating client on the TLS connection
        to the TTRP (which appears as the server from that client's
        perspective) to backend applications.  The multi-hop syntax of the
        Forwarded field is expressive but also more complicated,
        which would make processing it more cumbersome and, more importantly,
        would make properly sanitizing its content, as required by <xref
        target="sec"/> to prevent field injection, considerably more difficult
        and error-prone. Thus, this document opted for a flatter and more
        straightforward structure.</t>
      </section>
      <section anchor="the-whole-certificate-and-certificate-chain">
        <name>The Whole Certificate and Certificate Chain</name>
        <t>Different applications will have varying requirements about what
        information from the client certificate is needed, such as the subject
        and/or issuer distinguished name, subject alternative name(s), serial
        number, subject public key info, fingerprint, etc. Furthermore, some
        applications, such as that described in <xref target="RFC8705"/>, make
        use of the entire certificate. In order to accommodate the latter and
        ensure wide applicability by not trying to cherry-pick particular
        certificate information, this document opted to pass the full, encoded
        certificate as the value of the Client-Cert field.</t>
        <t>The validation of the client certificate and chain of the mutually
        authenticated TLS connection is typically performed by the TTRP during
        the handshake.  With the responsibility of certificate validation
        falling on the TTRP, the end-entity certificate is oftentimes
        sufficient for the needs of the origin server.  The separate
        Client-Cert-Chain field can convey the certificate chain for
        origin server deployments that require this additional
        information.</t>
      </section>
    </section>
    <section anchor="acknowledgements" toc="default" numbered="false">
      <name>Acknowledgements</name>
      <t>The authors would like to thank the following individuals who have contributed to this document in various ways, ranging from just being generally supportive of bringing forth the document to providing specific feedback or content:</t>
      <ul spacing="normal">

        <li><t><contact fullname="Evan Anderson"/></t></li>
        <li><t><contact fullname="Annabelle Backman"/></t></li>
        <li><t><contact fullname="Alan Frindell"/></t></li>
        <li><t><contact fullname="Rory Hewitt"/></t></li>
        <li><t><contact fullname="Fredrik Jeansson"/></t></li>
        <li><t><contact fullname="Benjamin Kaduk"/></t></li>
        <li><t><contact fullname="Torsten Lodderstedt"/></t></li>
        <li><t><contact fullname="Kathleen Moriarty"/></t></li>
        <li><t><contact fullname="Mark Nottingham"/></t></li>
        <li><t><contact fullname="Erik Nygren"/></t></li>
        <li><t><contact fullname="Mike Ounsworth"/></t></li>
        <li><t><contact fullname="Lucas Pardue"/></t></li>
        <li><t><contact fullname="Matt Peterson"/></t></li>
        <li><t><contact fullname="Eric Rescorla"/></t></li>
        <li><t><contact fullname="Justin Richer"/></t></li>
        <li><t><contact fullname="Michael Richardson"/></t></li>
        <li><t><contact fullname="Joe Salowey"/></t></li>
        <li><t><contact fullname="Rich Salz"/></t></li>
        <li><t><contact fullname="Mohit Sethi"/></t></li>
        <li><t><contact fullname="Rifaat Shekh-Yusef"/></t></li>
        <li><t><contact fullname="Travis Spencer"/></t></li>
        <li><t><contact fullname="Nick Sullivan"/></t></li>
        <li><t><contact fullname="Willy Tarreau"/></t></li>
        <li><t><contact fullname="Martin Thomson"/></t></li>
        <li><t><contact fullname="Peter Wu"/></t></li>
        <li><t><contact fullname="Hans Zandbelt"/></t></li>
      </ul>
    </section>
  </back>
</rfc>

