<?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" category="std" docName="draft-ietf-sidrops-rrdp-same-origin-04" number="9674" ipr="trust200902" xml:lang="en" symRefs="true" sortRefs="true" submissionType="IETF" consensus="true" updates="8182" obsoletes="" tocInclude="true" version="3">

  <front>
    <title abbrev="RRDP Same-Origin Policy">Same-Origin Policy for the RPKI Repository Delta Protocol (RRDP)</title>
    <seriesInfo name="RFC" value="9674"/>
    <author fullname="Job Snijders" initials="J." surname="Snijders">
      <organization>Fastly</organization>
      <address>
        <postal>
          <city>Amsterdam</city>
          <country>Netherlands</country>
        </postal>
        <email>job@fastly.com</email>
      </address>
    </author>

    <date month="December" year="2024"/>

    <area>OPS</area>
    <workgroup>sidrops</workgroup>

    <keyword>same-origin</keyword>
    <keyword>RPKI</keyword>
    <keyword>RRDP</keyword>

    <abstract>
      <t>
        This document describes a Same-Origin Policy (SOP) requirement for Resource Public Key Infrastructure (RPKI) Repository Delta Protocol (RRDP) servers and clients.
        Application of a SOP in RRDP client/server communication isolates resources such as Delta and Snapshot files from different Repository Servers, reducing possible attack vectors.
        This document updates RFC 8182.
      </t>
    </abstract>
  </front>

  <middle>
    <section anchor="intro">
      <name>Introduction</name>

      <t>
        This document specifies a Same-Origin Policy (SOP) requirement for RPKI Repository Delta Protocol (RRDP) servers and clients.
        The SOP concept is a security mechanism to restrict how a document loaded from one origin can cause interaction with resources from another origin.
        See <xref target="RFC6454"/> for an overview of the concept of an "origin".
        Application of a SOP in RRDP client/server communication isolates resources such as Delta and Snapshot files from different Repository Servers, reducing possible attack vectors.
        Another way to avoid undesirable implications (as described in <xref target="issue"/>) would be for a future version of RRDP to use relative URIs instead of absolute URIs.
        This document updates <xref target="RFC8182"/>.
      </t>

      <section anchor="requirements">
        <name>Requirements Language</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>

    <section anchor="issue">
      <name>Implications of Cross-Origin Resource Requests in RRDP</name>
      <t>
        The first RRDP specification did not explicitly disallow 'cross-origin' URI references from the Update Notification file (<xref target="RFC8182" section="3.5.1"/>) towards Delta (<xref target="RFC8182" section="3.5.3"/>) and Snapshot (<xref target="RFC8182" section="3.5.2"/>) files, and it was silent on the topic of HTTP Redirection (<xref target="RFC9110" section="15.4"/>).
      </t>
      <t>
        The implication of cross-origin references in Update Notification files is that one Repository Server can reference RRDP resources on another Repository Server and in doing so inappropriately increase the resource consumption for both RRDP clients and the referenced Repository Server.
        An adversary could also employ cross-origin HTTP Redirects towards other Repository Servers, causing similar undesirable behavior.
      </t>
    </section>

    <section>
      <name>Changes to RFC 8182</name>
      <t>
        To overcome the issue described in <xref target="issue"/>, RRDP Repository Servers and Clients <bcp14>MUST</bcp14> apply a Same-Origin Policy to both the URIs referenced in an Update Notification File and any HTTP Redirects.
      </t>
      <section>
	<name>New Requirements for RRDP Repository Servers</name>
        <t>
          The following checklist items are added to <xref target="RFC8182" section="3.5.1.3"/>:
        </t>
        <t>NEW</t>
        <blockquote>
          <ul spacing="normal">
            <li>The "uri" attribute in the snapshot element and optional delta
            elements <bcp14>MUST</bcp14> be part of the same origin (i.e.,
            represent the same principal), meaning referenced URIs
            <bcp14>MUST</bcp14> have the same scheme, host, and port as the
            URI for the Update Notification File specified in the referring
            RRDP SIA AccessDescription.</li>
            <li>The Repository Server <bcp14>MUST NOT</bcp14> respond with
            HTTP Redirects towards locations with an origin different from the
            origin of the Update Notification File specified in the referring
            RRDP SIA AccessDescription.</li>
          </ul>
        </blockquote>
      </section>
      <section>
	<name>New Requirements for Relying Parties Using RRDP</name>
        <t>
          The following adds to <xref target="RFC8182" section="3.4.1"/>:
        </t>
        <t>NEW</t>
        <blockquote>
          <ul spacing="normal">
            <li>The Relying Party <bcp14>MUST</bcp14> verify whether the
            "uri" attributes in the Update Notification File are of the same
            origin as the Update Notification File itself.  If this
            verification fails, the file <bcp14>MUST</bcp14> be rejected and
            RRDP cannot be used; see Section <xref target="RFC8182" section="3.4.5" sectionFormat="bare"/>
            for considerations.  Implementations <bcp14>SHOULD</bcp14> log a
            message when cross-origin referrals are detected.
            </li>
            <li>The Relying Party <bcp14>MUST NOT</bcp14> follow HTTP
            Redirection that results from attempts to download Update
            Notification, Delta, and Snapshot files if the target origin is
            different from the origin of the Update Notification File
            specified in the referring RRDP SIA AccessDescription.  If this
            verification fails, the RRDP session <bcp14>MUST</bcp14> be
            rejected and RRDP cannot be used; see Section <xref target="RFC8182"
            section="3.4.5" sectionFormat="bare"/> for considerations.  Implementations
            <bcp14>SHOULD</bcp14> log a message when cross-origin redirects
            are detected.
            </li>
          </ul>
        </blockquote>
      </section>
    </section>

    <section>
      <name>Deployability in the Internet's Current RPKI</name>
      <t>
        Analyzing the <xref target="rpkiviews"/> archives for the period from April to September 2024, only one RRDP server (reached following the Trust Anchor Locators (TALs)  of the five Regional Internet Registries) employed a same-origin HTTP redirect.
        In the period October 2021 - October 2024 no RRDP Repository Servers were observed that employed cross-origin URIs in Update Notification Files.
      </t>
      <t>
        This means that imposing a requirement for the application of a Same-Origin Policy does not cause any existing commonly used RRDP Repository Server operations to become non-compliant.
      </t>
    </section>

    <section anchor="security">
      <name>Security Considerations</name>
      <t>
        This document addresses an oversight in the original RRDP specification: Cross-origin requests are detrimental as they allow one repository operator to increase resource consumption for other repository operators and RRDP clients.
      </t>
    </section>

    <section anchor="iana">
      <name>IANA Considerations</name>
      <t>
        This document has no IANA actions.
      </t> 
    </section>
  </middle>

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

        <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.6454.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.8182.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9110.xml"/>
      </references>

      <references>
        <name>Informative References</name>

        <reference anchor="rpkiviews" target="https://www.rpkiviews.org">
          <front>
            <title>rpkiviews</title>
            <author fullname="Job Snijders" initials="J" surname="Snijders"/>
            <date/>
          </front>
        </reference>

      </references>
    </references>

    <section anchor="acknowledgements" numbered="false">
      <name>Acknowledgements</name>
      <t>
        The author wishes to thank
        <contact fullname="Theo Buehler"/>,
        <contact fullname="Claudio Jeker"/>,
        <contact fullname="Alberto Leiva"/>,
        <contact fullname="Tim Bruijnzeels"/>,
        <contact fullname="Ties de Kock"/>,
        <contact fullname="Martin Hoffmann"/>,
        and
        <contact fullname="Mikhail Puzanov"/>
        for their helpful feedback, comments, and implementation work.
        The author wishes to thank
        <contact fullname="Keyur Patel"/>,
        <contact fullname="Meral Shirazipour"/>,
        <contact fullname="Niclas Comstedt "/>,
        <contact fullname="Dan Harkins"/>,
        <contact fullname="Erik Kline"/>,
        <contact fullname="Roman Danyliw"/>,
        and
        <contact fullname="Éric Vyncke"/>
        for their review.
      </t>
    </section>


  </back>

</rfc>
