<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc rfcedstyle="yes"?>
<?rfc subcompact="no"?>
<?rfc symrefs="yes"?>
<?rfc comments="yes" ?>
<?rfc inline="yes" ?>

<rfc ipr="trust200902" category="info" docName='draft-melnikov-smime-header-signing-04'>
  <front>
    <title abbrev="Header protection with S/MIME">
      Considerations for protecting Email header with S/MIME
    </title>
    <author initials="A." surname="Melnikov" fullname="Alexey Melnikov">
      <organization>Isode Ltd</organization>
      <address>
	<postal>
	  <street>14 Castle Mews</street>
	  <city>Hampton</city>
	  <region>Middlesex</region>
	  <code>TW12 2NP</code>
	  <country>UK</country>
	</postal>
	<email>Alexey.Melnikov@isode.com</email>
      </address>
    </author>
      
    <date year="2017" />
    
    <keyword>Email</keyword>
    <keyword>S/MIME</keyword>
      
    <abstract>

    <t>
    This document describes best practices for handling of Email header protected by S/MIME.
    It also adds a new Content-Type parameter to help distinguish an S/MIME protected forwarded message
    from an S/MIME construct protecting message header. 
    </t>
	
    </abstract>
    
  </front>
  <middle>

    <section title="Introduction">

        <t>
	      S/MIME <xref target="RFC5751"/> is typically used to protect (sign and/or encrypt) Email message body parts,
        but not header of corresponding Email messages. Header fields may contain confidential information
        or information whose validity need protecting from disclosure or modification.
        <xref target="RFC5751"/> describes how to protect the Email message header <xref target="RFC5322"/>,
        by wrapping the message inside a message/rfc822 container <xref target="RFC2045"/>:

	<list style="empty">

   <t>
   In order to protect outer, non-content-related message header fields
   (for instance, the "Subject", "To", "From", and "Cc" fields), the
   sending client MAY wrap a full MIME message in a message/rfc822
   wrapper in order to apply S/MIME security services to these header
   fields.  It is up to the receiving client to decide how to present
   this "inner" header along with the unprotected "outer" header.
   </t>

   <t>
   When an S/MIME message is received, if the top-level protected MIME
   entity has a Content-Type of message/rfc822, it can be assumed that
   the intent was to provide header protection.  This entity SHOULD be
   presented as the top-level message, taking into account header
   merging issues as previously discussed.
   </t>
	</list>

        </t>

        <t>
  <!--////Define "inner" and "outer" header?-->
        While the above advice helps in protecting message header fields, it doesn't provide
        enough guidance on what information should and should not be included in outer (unprotected) header and
        how information from outer and inner headers should be presented to users.
	      This document describes best UI and other practices for handling of messages wrapped
        inside message/rfc822 body parts.
        The goal of this document is to improve interoperability and minimize damage caused by
	      possible differences between inner and outer headers.
        </t>

    </section>
    
    <section title="Conventions Used in This Document">
      
      <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 title="Recommendations for handling of S/MIME protected header">

      <t>
        <!--////As per Robert: consider signing only case - if we care about authenticity of the header.-->

        When generating S/MIME messages which protect header fields by wrapping a message inside message/rfc822 wrapper:

        <list style='numbers'>

<!--
            <t>Having the data represented twice is a bad idea, as gateways and other
            entities may need to check for consistency.
 ////But this goes against a recommendation for the "Subject" header field.
            </t>
-->

          <t>
            If a header field is being encrypted because it is sensitive, its true value
            MUST NOT be included in the outer header. If the header field is mandatory
            according to RFC 5322, a stub value (or a value indicating that the outer value is not to be used)
            is to be included.
          </t>

          <t>
            The outer header SHOULD be minimal in order to avoid disclosure of confidential information.
<!--////This would also help when merging information from outer and inner headers.
    But does this need to be said?-->
            It is recommended that the outer header only contains "Date" (set to the same value as in the inner header, or,
            if the Date value is also sensitive, to Monday 9am of the same week),
            possibly "Subject" and "To"/"Bcc" header fields. In particular, Keywords, In-Reply-To and References header fields
            SHOULD NOT be included in the outer header; "To" and "Cc" header fields should be omitted and replaced with
            "Bcc: undisclosed-recipients;".
<!--Message-ID can contain sensitive domain part (just because of how Message-IDs are generated. But it is not clear that any special advice would be useful here.
            <cref>What about Message-ID? Is there a way to protect it or create a separate value in the encrypted part?</cref>
  -->
            <vspace blankLines='1'/>

            But note that having key header fields duplicated in the outer header is convenient
            for many message stores (e.g. IMAP) and clients that can't decode S/MIME encrypted messages.
            In particular, Subject/To/Cc/Bcc/Date header field values are returned in IMAP ENVELOPE FETCH data item
            <xref target="RFC3501"/>, which is frequently used by IMAP clients in order to avoid parsing
            message header.
          </t>
          
          <!--            
From David:
                 From: could be the envelope sender
                 Bcc could be used to minimise the heading. Or use To: with the envelope addresses
             Minimisation makes it easier for the UA to merge the additional fields
             added to the outer heading after signing as a result of MTS transfer, and the
             original heading.
-->

          <t>
            The "Subject" header field value of the outer header SHOULD either be identical to
            the inner "Subject" header field value, or contain a clear indication that the outer value
            is not to be used for display (the inner header field value would contain the true value).
          </t>

        </list>
      </t>

      <t>Note that recommendations listed above only apply to non MIME header fields (header fields with names not starting with "Content-" prefix).</t>

      <t>Note that the above recommendations can also negatively affect antispam processing.</t>

      <t>
        When displaying S/MIME messages which protect header fields by wrapping a message inside message/rfc822 wrapper:
        
          <list style='numbers'>

            <t>
            The outer headers might be tampered with, so a receiving client SHOULD
            ignore them, unless they are protected in some other way(*).
            If a header field is present in the inner header, only the inner header field value
            MUST be displayed (and the corresponding outer value must be ignored).
            If a particular header field is only present in the outer header, it MAY be ignored (not displayed)
            or it MAY be displayed with a clear indicator that it is not trustworthy(*).<vspace blankLines="1"/>
            
            (*) - this only applies if the header field is not protected is some other way,
            for example with a DKIM signature that validates and is trusted.
            </t>

          </list>
      </t>

    </section>

    <section title="New Content-Type header field parameter: forwarded">

      <t>
        This document defines a new Content-Type header field parameter <xref target="RFC2045"/> with name "forwarded".
        The parameter value is case-insensitive and can be either "yes" or "no". (The default value being "yes").
        The parameter is only meaningful with media type "message/rfc822" and "message/global" <xref target="RFC6532"/>
        when used within S/MIME encrypted body parts.
        The value "yes" means that the message nested inside message/rfc822 is a forwarded message and not a construct
        created solely to protect the inner header.
      </t>

      <t>
      Instructions in <xref target="RFC5751"/> describing how to protect the Email message header <xref target="RFC5322"/>,
      by wrapping the message inside a message/rfc822 container <xref target="RFC2045"/> are thus updated to read:

      <list style="empty">

      <t>
        In order to protect outer, non-content-related message header fields
        (for instance, the "Subject", "To", "From", and "Cc" fields), the
        sending client MAY wrap a full MIME message in a message/rfc822
        wrapper in order to apply S/MIME security services to these header
        fields.  It is up to the receiving client to decide how to present
        this "inner" header along with the unprotected "outer" header.
      </t>

      <t>
        When an S/MIME message is received, if the top-level protected MIME
        <!--////Is "without the forwarded parameter" still correct considering that the new value is yes?-->
        entity has a Content-Type of message/rfc822 or message/global without the "forwarded" parameter
        or with the "forwarded" parameter set to "no", it can be assumed that
        the intent was to provide header protection.  This entity SHOULD be
        presented as the top-level message, taking into account header
        merging issues as previously discussed.
      </t>

      </list>
      </t>

    </section>

    <section title="Example message with S/MIME header protection">

      <t>
        This document requests no action from IANA. RFC Editor should delete this section before publication.
      </t>

      <figure>
<artwork>
  <![CDATA[
Content-Type: message/rfc822; forwarded=no

Date: Mon, 25 Sep 2017 17:31:42 +0100 (GMT Daylight Time)
From: "Alexey Melnikov" <alexey.melnikov@example.net>
Message-ID: <e4a483cb-1dfb-481d-903b-298c92c21f5e@mattingly.example.net>
MIME-Version: 1.0
MMHS-Primary-Precedence: 3
Subject: Secret meeting at my place
To: somebody@example.net
X-Mailer: Isode Harrier Web Server
content-type: text/plain; charset=us-ascii

This is a secret message worth protecting.
]]></artwork>
      </figure>

      <t>
        <cref>Extend the example to show different inner and outer header fields and clarify what should be displayed?</cref>
      </t>

    </section>


    <section title="IANA Considerations">

      <t>
      This document requests no action from IANA. RFC Editor should delete this section before publication.
      </t>

    </section>

    <section title="Security Considerations" anchor="seccons">

      <t>This document talks about UI considerations, including security considerations, when processing
      wrapped message/rfc822 messages protecting header fields. One of the goals of this document
      is to specify UI for displaying such messages which is less confusing/misleading and thus more secure.
      </t>
      
      <t>
      The document is not defining new protocol, so it doesn't
      create any new security concerns not already covered by S/MIME <xref target="RFC5751"/>,
      MIME <xref target="RFC2045"/> and Email <xref target="RFC5322"/> in general.
      </t>

    </section>
    
  </middle>
  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?> <!-- Keywords -->
      <?rfc include="reference.RFC.2045"?> <!-- MIME, part 1 -->
      <?rfc include="reference.RFC.5322"?> <!-- Email -->
      <?rfc include="reference.RFC.5751"?> <!-- S/MIME 3.2 - Message Specification -->
      <?rfc include="reference.RFC.6532"?> <!-- EAI (message/global definition) -->
    </references>

    <references title="Informative References">

      <?rfc include="reference.RFC.3501"?>

    </references>

    <section title="Acknowledgements">
	
      <t>Thank you to Wei Chuang, Steve Kille, David Wilson and Robert Williams for suggestions, comments and corrections on this document.
      Some ideas were also taken from Daniel Kahn Gillmor's email on the OpenPGP mailing list.</t>

      <t>David Wilson came up with the idea of defining a new Content-Type header field parameter to distinguish
      forwarded messages from inner header field protection constructs.</t>
      
    </section>
  </back>
</rfc>
