<?xml version="1.0" encoding="UTF-8"?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no" ?>
<?rfc linkmailto="no" ?>
<?rfc editing="no" ?>
<?rfc comments="yes" ?>
<?rfc inline="yes"?>
<?rfc rfcedstyle="yes"?>
<?rfc-ext allow-markup-in-artwork="yes" ?>
<?rfc-ext include-index="no" ?>

<rfc ipr="trust200902" docName="draft-young-md-query-saml-24" submissionType="independent" category="info"
    xmlns:xi="http://www.w3.org/2001/XInclude">
    <front>
        <title abbrev="SAML Profile for MDQ Protocol">SAML Profile for the Metadata Query Protocol</title>

        <author initials="I.A." fullname="Ian A. Young" surname="Young" role="editor">
            <organization>Independent</organization>
            <address>
                <email>ian@iay.org.uk</email>
            </address>
        </author>

        <date/>

        <keyword>metadata</keyword>
        <keyword>SAML</keyword>

        <abstract>
            <t>
                This document profiles the Metadata Query Protocol for use
                with SAML metadata.
            </t>
            <t>
                This document is a product of the Research and Education Federations (REFEDS) Working Group process.
            </t>
        </abstract>

        <note title="Editorial Note (To be removed by RFC Editor before publication)">
            <t>
                Discussion of this draft takes place on the MDX
                mailing list (mdx@lists.iay.org.uk), which is accessed from
                <xref target="MDX.list"/>.
            </t>
            <t>
                XML versions, latest edits and the issues list for this document
                are available from <xref target="md-query"/>.
            </t>
            <t>
                The changes in this draft are summarized in <xref target="latest.changes"/>.
            </t>
        </note>

    </front>

    <middle>
        <section title="Introduction">

            <t>
                This document profiles the <xref target="I-D.young-md-query">Metadata Query Protocol</xref> for use
                with <xref target="SAML2Meta">SAML metadata</xref>.
            </t>
            <t>
                The Research and Education Federations group (<xref target="REFEDS"/>)
                is the voice that articulates the mutual needs of research and education
                identity federations worldwide. It aims to represent the requirements of
                research and education in the ever-growing space of access and identity
                management.
            </t>
            <t>
                From time to time REFEDS
                will wish to publish a document in the Internet RFC series.  Such
                documents will be published as part of the RFC Independent Submission
                Stream <xref target="RFC4844"/>; however the REFEDS working group sign-off process will
                have been followed for these documents, as described in
                the <xref target="REFEDS.agreement">REFEDS Participant's Agreement</xref>.
            </t>
            <t>
                This document is a product of the REFEDS Working Group process.
            </t>

            <section title="Notation and Conventions">
                <t>
                    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
                    NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
                    "MAY", and "OPTIONAL" in this document are to be interpreted as
                    described in BCP&#160;14 <xref target="RFC2119"/> <xref target="RFC8174"/>
                    when, and only when, they appear in all capitals, as shown here.
                </t>
                <t>
                    This document makes use of the Augmented BNF metalanguage defined in <xref target="STD68"/>.
                </t>
            </section>

        </section>

        <section title="Request Profile">

            <section title="Content Type">
                <t>
                    Requests compliant with this profile MUST include the following HTTP header to indicate that
                    the metadata returned should be SAML metadata (see Appendix A of <xref target="SAML2Meta"/>):
                </t>
                <figure>
                    <artwork>Accept: application/samlmetadata+xml</artwork>
                </figure>
            </section>

            <section title="Identifiers" anchor="request.identifiers">

                <section title="Unique Identifier">
                    <t>
                        Each entity known to the responder MUST be associated with the unique identifier
                        of the entity, corresponding to the <tt>entityID</tt> attribute
                        of the entity's <tt>EntityDescriptor</tt> element in SAML metadata.
                    </t>
                </section>

                <section title="Transformed Identifier" anchor="transformed_identifier">
                    <t>
                        <xref target="SAML2Core">SAML 2.0</xref> includes profiles based on the transfer
                        of an "artifact" containing the unique identifier of a SAML entity transformed by
                        means of the
                        <xref target="RFC3174">SHA-1</xref> hash algorithm (see <xref target="SAML2Bind"/>
                        sections 3.6 and 3.6.4).
                    </t>
                    <t>
                        In order to support use cases in which clients may be in possession of only such a transformed
                        representation of a SAML entity's unique identifier without any way to establish the original
                        entity identifier, a responder compliant with this profile MUST associate each entity
                        with an identifier matching the
                        <tt>sha1id</tt> production in the following ABNF grammar, and treat
                        such an identifier as equivalent to
                        the corresponding untransformed identifier:
                    </t>
                    <figure>
                        <artwork type="abnf"><![CDATA[
SHA1     = %x73 %x68 %x61 %x31 ; lower case "sha1"
DIGIT    = %x30-39
HEXDIGIT = DIGIT | %x61-66 ; lower case a-f
sha1id   = "{" SHA1 "}" sha1hex
sha1hex  = 40*HEXDIGIT
]]></artwork>
                    </figure>
                    <t>
                        In the above, the <tt>sha1hex</tt> component encodes the 20-octet
                        (160-bit) binary SHA-1 hash value as a sequence of 40 lower case hexadecimal digits.
                    </t>
                    <t>
                        For example, the identifier
                    </t>
                    <figure>
                        <artwork>http://example.org/service</artwork>
                    </figure>
                    <t>
                        transformed by means of SHA-1 hashing would become
                    </t>
                    <figure>
                        <artwork>{sha1}11d72e8cf351eb6c75c721e838f469677ab41bdb</artwork>
                    </figure>
                    <t>
                        Responder implementations MAY detect malformed SHA-1 transformed identifiers
                        (for example where the string of characters
                        following the "}" contains characters other than hexadecimal digits, or is other than
                        exactly 40 characters in length) and return an HTTP status code of 400
                        ("bad request"). Alternatively, implementations MAY process these as normal
                        identifiers and return an HTTP status code of 404 ("not found") if appropriate.
                    </t>
                </section>

                <section title="Additional Identifiers">
                    <t>
                        Entities MAY also be associated with any number of additional responder-defined
                        identifiers naming arbitrary groups of entities.
                    </t>
                </section>

            </section>

        </section>

        <section title="Response Profile">

            <section title="Response Cardinality">
                <t>
                    A request may return information for any number of entities, including none. Responses compliant with
                    this profile MUST use the appropriate representation described below depending on the number of
                    <tt>EntityDescriptor</tt> elements returned.
                </t>
                <section title="No Entity Descriptors Returned">
                    <t>
                        A response which returns no <tt>EntityDescriptor</tt> elements
                        MUST be represented by an HTTP status code of 404 ("not found").
                    </t>
                </section>
                <section title="One Entity Descriptor Returned">
                    <t>
                        A response which returns a single <tt>EntityDescriptor</tt> element
                        MUST use that element as its document element.
                        The responder MUST NOT make use of a <tt>EntitiesDescriptor</tt>
                        element in this situation (see <xref target="SAML2Meta"/> section 2.3).
                    </t>
                    <t>
                        Such a response MUST include the following HTTP header to indicate that
                        the metadata returned is SAML metadata:
                    </t>
                    <figure>
                        <artwork>Content-Type: application/samlmetadata+xml</artwork>
                    </figure>
                </section>
                <section title="More Than One Entity Descriptor Returned">
                    <t>
                        A response which returns more than one <tt>EntityDescriptor</tt> element
                        MUST consist of a document element which is an <tt>EntitiesDescriptor</tt>
                        element, containing the returned <tt>EntityDescriptor</tt> elements
                        as children. Responses MUST NOT contain nested <tt>EntitiesDescriptor</tt>
                        elements.
                    </t>
                    <t>
                        Such a response MUST include the following HTTP header to indicate that
                        the metadata returned is SAML metadata:
                    </t>
                    <figure>
                        <artwork>Content-Type: application/samlmetadata+xml</artwork>
                    </figure>
                </section>
            </section>

        </section>

        <section title="Security Considerations" anchor="sec_cons">

            <section title="Integrity" anchor="sec_cons_integrity">
                <t>
                    As SAML metadata contains information necessary for the secure operation of interacting services it is
                    strongly RECOMMENDED that a mechanism for integrity checking is provided to clients.
                </t>
                <t>
                    It is RECOMMENDED that the integrity checking mechanism provided by a responder is a digital
                    signature embedded in the returned metadata document, as defined by
                    <xref target="SAML2Meta"/> section 3.
                </t>
                <t>
                    Such digital signatures:
                    <list style="symbols">
                        <t>SHOULD use an RSA keypair whose modulus is no less than 2048 bits in length.</t>
                        <t>MUST NOT use the SHA-1 cryptographic hash algorithm as a digest algorithm.</t>
                        <t>MUST NOT use the MD5 cryptographic hash algorithm as a digest algorithm.</t>
                        <t>SHOULD otherwise follow current cryptographic best practices in algorithm selection.</t>
                    </list>
                </t>
            </section>

            <section title="Use of SHA-1 in Transformed Identifiers" anchor="sec_conf_sha1">
                <t>
                    This profile mandates the availability of an identifier synonym mechanism based on
                    the SHA-1 cryptographic hash algorithm. Although SHA-1 is now regarded as weak enough
                    to exclude it from use in new cryptographic systems, its use in this profile is
                    necessary for full support of the SAML 2.0 standard.
                </t>
                <t>
                    The use of SHA-1 in section 3.6.4 of <xref target="SAML2Bind"/>,
                    and its resulting use in this protocol, would be
                    vulnerable to an attack in which metadata was introduced
                    into a system by an attacker capable of creating an entity
                    identifier with the same SHA-1 hash as that of an existing
                    entity's identifier.
                </t>
                <t>
                    Such an identifier is known as a <em>second preimage</em>
                    of the original, and SHA-1's resistance to discovery of
                    it is referred to as SHA-1's <em>second-preimage
                    resistance</em>.
                </t>
                <t>
                    As demonstrated by the the <xref target="SHAttered"/> and
                    <xref target="Shambles"/> attacks, the SHA-1 algorithm is
                    known to have weak collision resistance.
                    However, at the time of writing no attacks are known on
                    SHA-1's second-preimage resistance; a result in this area
                    would be required to provide the basis of an attack based
                    on duplicating the SHA-1 hash of an existing identifier.
                    As a result, the use of SHA-1 in SAML and in this protocol
                    is not believed to introduce a security concern.
                </t>
                <t>
                    Implementations may guard against the possibility of a future
                    practical attack on the second-preimage resistance of SHA-1
                    by treating two entities whose
                    <tt>entityID</tt> values have the same SHA-1 equivalent as an
                    indicator of malicious intent on the part of the owner of one of the entities.
                </t>
            </section>

        </section>

        <section title="IANA Considerations">
            <t>
                This document has no actions for IANA.
            </t>
        </section>

        <section title="Acknowledgements">
            <t>The editor would like to acknowledge the following individuals for their contributions to this document:
                <list>
                    <t>Scott Cantor (The Ohio State University)</t>
                    <t>Leif Johansson (SUNET)</t>
                    <t>Joe St Sauver (University of Oregon)</t>
                    <t>Tom Scavo (Internet2)</t>
                </list>
            </t>
        </section>

    </middle>

    <back>

        <references title="Normative References">

            <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.3174.xml"/>
            <xi:include
                href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>

            <reference anchor="I-D.young-md-query">
                <front>
                    <title>Metadata Query Protocol</title>
                    <author initials="I.A." fullname="Ian A. Young" surname="Young" role="editor"/>
                    <date year='2026' month='January'/>
                </front>
                <seriesInfo name="Internet-Draft" value="draft-young-md-query-23"/>
            </reference>

            <reference anchor="SAML2Bind">
                <front>
                    <title>
                        Bindings for the Security Assertion Markup Language
                        (SAML) V2.0
                    </title>
                    <author fullname="Scott Cantor" initials="S." surname="Cantor"/>
                    <author fullname="Frederick Hirsch" initials="F." surname="Hirsch"/>
                    <author fullname="John Kemp" initials="J." surname="Kemp"/>
                    <author fullname="Rob Philpott" initials="R." surname="Philpott"/>
                    <author fullname="Eve Maler" initials="E." surname="Maler"/>
                    <date year="2005" month="March"/>
                </front>
                <seriesInfo name="OASIS Standard" value="saml-bindings-2.0-os"/>
            </reference>

            <reference anchor="SAML2Meta">
                <front>
                    <title>Metadata for the Security Assertion Markup Language
                        (SAML) V2.0</title>
                    <author fullname="Scott Cantor" initials="S." surname="Cantor">
                        <organization>Internet2</organization>
                        <address>
                            <email>cantor.2@osu.edu</email>
                        </address>
                    </author>
                    <author fullname="Jahan Moreh" initials="J." surname="Moreh">
                        <organization>Sigaba</organization>
                        <address>
                            <email>jmoreh@sigaba.com</email>
                        </address>
                    </author>
                    <author fullname="Rob Philpott" initials="R." surname="Philpott">
                        <organization>RSA Security</organization>
                        <address>
                            <email>rphilpott@rsasecurity.com</email>
                        </address>
                    </author>
                    <author fullname="Eve Maler" initials="E." surname="Maler">
                        <organization>Sun Microsystems</organization>
                        <address>
                            <email>eve.maler@sun.com</email>
                        </address>
                    </author>
                    <date year="2005" month="March"/>
                </front>
                <seriesInfo name="OASIS Standard" value="saml-metadata-2.0-os"/>
                <format type="PDF" target="http://docs.oasis-open.org/security/saml/v2.0/saml-metadata-2.0-os.pdf"/>
            </reference>

            <reference anchor="STD68" target="https://www.rfc-editor.org/info/rfc5234">
                <front>
                    <title>Augmented BNF for Syntax Specifications: ABNF</title>
                    <author initials="D." surname="Crocker" fullname="D. Crocker" role="editor"/>
                    <author initials="P." surname="Overell" fullname="P. Overell"/>
                    <date year="2008" month="January"/>
                </front>
                <seriesInfo name="STD" value="68"/>
                <seriesInfo name="RFC" value="5234"/>
                <seriesInfo name="DOI" value="10.17487/RFC5234"/>
            </reference>

        </references>

        <references title="Informative References">

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

            <reference anchor="REFEDS" target="http://www.refeds.org/">
                <front>
                    <title>REFEDS Home Page</title>
                    <author>
                        <organization>Research and Education Federations</organization>
                    </author>
                    <date/>
                </front>
            </reference>

            <reference anchor="REFEDS.agreement" target="https://refeds.org/about/about_agreement.html">
                <front>
                    <title>REFEDS Participant's Agreement</title>
                    <author>
                        <organization>Research and Education Federations</organization>
                    </author>
                    <date/>
                </front>
            </reference>

            <reference anchor="SAML2Core"
                    target="http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf">
                <front>
                    <title>Assertions and Protocol for the OASIS Security Assertion Markup Language
                        (SAML) V2.0</title>
                    <author fullname="Scott Cantor" initials="S." surname="Cantor">
                        <organization>Internet2</organization>
                        <address>
                            <email>cantor.2@osu.edu</email>
                        </address>
                    </author>
                    <author fullname="John Kemp" initials="J." surname="Kemp">
                        <organization>Nokia</organization>
                        <address>
                            <email>John.Kemp@nokia.com</email>
                        </address>
                    </author>
                    <author fullname="Rob Philpott" initials="R." surname="Philpott">
                        <organization>RSA Security</organization>
                        <address>
                            <email>rphilpott@rsasecurity.com</email>
                        </address>
                    </author>
                     <author fullname="Eve Maler" initials="E." surname="Maler">
                        <organization>Sun Microsystems</organization>
                        <address>
                            <email>eve.maler@sun.com</email>
                        </address>
                    </author>
                    <date year="2005" month="March"/>
                </front>
                <seriesInfo name="OASIS Standard" value="saml-core-2.0-os"/>
            </reference>

            <reference anchor="MDX.list" target="http://lists.iay.org.uk/listinfo.cgi/mdx-iay.org.uk">
                <front>
                    <title>MDX Mailing List</title>
                    <author initials="I.A." fullname="Ian A. Young" surname="Young" role="editor"/>
                    <date/>
                </front>
            </reference>

            <reference anchor="md-query" target="https://github.com/iay/md-query">
                <front>
                    <title>md-query Project</title>
                    <author initials="I.A." fullname="Ian A. Young" surname="Young" role="editor"/>
                    <date/>
                </front>
            </reference>

            <reference anchor="SHAttered" target="https://shattered.io">
                <front>
                    <title>SHAttered</title>
                    <author/>
                    <date year="2017" month="February"/>
                </front>
            </reference>

            <reference anchor="Shambles" target="https://sha-mbles.github.io">
                <front>
                    <title>SHA-1 is a Shambles</title>
                    <author/>
                    <date year="2020" month="January"/>
                </front>
            </reference>

        </references>

        <section title="Change Log (to be removed by RFC Editor before publication)" anchor="change.log">

            <section title="draft-young-md-query-saml-00">
                <t>
                    Initial version.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-00" anchor="changes.since.draft-young-md-query-saml-00">
                <t>
                    Added REFEDS RFC stream boilerplate.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-01" anchor="changes.since.draft-young-md-query-saml-01">
                <t>
                    Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
                <t>
                    Rework <xref target="request.identifiers"/> to make the role of transformed identifiers
                    clearer. This changes the semantics slightly (malformed transformed identifiers
                    may now result in a 404 return rather than 400) but this gives implementers more
                    latitude in the way that they handle the feature.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-02">
                <t>
                    Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-03">
                <t>
                    Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
                <t>
                    Added an Editorial Note to help direct readers
                    back to the discussion.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-04">
                <t>
                    Fix reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-05">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-06">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-07">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-08">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
                <t>
                    Modernise normative language to include <xref target="RFC8174"/>.
                </t>
                <t>
                    Improved references to RFCs.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-09">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-10">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
                <t>
                    Replace citations in the abstract with straight textual
                    mentions, as required by the ID-NITS checklist.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-11">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
                <t>
                    Strengthen <xref target="sec_cons_integrity"/> so that SHA-1
                    now MUST NOT be used in the context of digital signatures.
                    This brings the section in line with current best practice
                    recommendations, particularly in light of the
                    <xref target="SHAttered"/> and
                    <xref target="Shambles"/> attacks.
                </t>
                <t>
                    Revised <xref target="sec_conf_sha1"/> on the use of SHA-1
                    in transformed identifiers to:
                    <list style="symbols">
                        <t>
                            Make clear that this is a SAML-level issue, not one
                            introduced by the query protocol.
                        </t>
                        <t>
                            Reference the attacks demonstrating SHA-1's weak
                            collision resistance.
                        </t>
                        <t>
                            Identify second-preimage resistance as the potential
                            source of the attack we'd be concerned about for
                            the query protocol.
                        </t>
                        <t>
                            Note that SHA-1's second-preimage resistance is
                            at present uncompromised.
                        </t>
                    </list>
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-12">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-13">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-14">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-15">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-16">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-17">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-18">
                <t>
                    Formatting changes to allow rendering with <tt>xml2rfc</tt> version 3.
                </t>
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-19">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-20">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-21">
                <t>
                  Added an <tt>abbrev</tt> to the <tt>title</tt> element to satisfy a
                  recommendation from <tt>xml2rfc</tt>.
                </t>
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
                <t>
                  Minor typographical corrections in change log.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-22">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-23" anchor="latest.changes">
                <t>
                  Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
            </section>

        </section>

    </back>
</rfc>
