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

<!-- [rfced] pre-edited by ST 02/07/24 -->

<!-- [rfced] draft submitted in xml v3 -->  

<!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-lamps-x509-policy-graph-05" number="0000" category="std" consensus="true" submissionType="IETF" obsoletes="" updates="5280" tocInclude="true" sortRefs="true" symRefs="true" xml:lang="en" version="3">

  <front>
    <title abbrev="Updates to X.509 Policy Validation">Updates to X.509 Policy Validation</title>
    <seriesInfo name="RFC" value="0000"/>
    <author initials="D." surname="Benjamin" fullname="David Benjamin">
      <organization>Google LLC</organization>
      <address>
        <email>davidben@google.com</email>
      </address>
    </author>

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

    <area>sec</area>
    <workgroup>lamps</workgroup>

<!-- [rfced] Please insert any keywords (beyond those that appear in
the title) for use on https://www.rfc-editor.org/search. -->

<keyword>example</keyword>

    <abstract>

<t>This document updates RFC 5280 to replace the algorithm for X.509 policy
validation with an equivalent, more efficient algorithm. The original algorithm
built a structure which scaled exponentially in the worst case, leaving
implementations vulnerable to denial-of-service attacks.</t>
    </abstract>
    <note removeInRFC="true">
      <name>Discussion Venues</name>
      <t>Discussion of this document takes place on the
    Limited Additional Mechanisms for PKIX and SMIME Working Group mailing list (spasm@ietf.org),
    which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/spasm/"/>.</t>
      <t>Source for this draft and an issue tracker can be found at
    <eref target="https://github.com/davidben/x509-policy-graph"/>.</t>
    </note>
  </front>
  <middle>

<section anchor="introduction">
      <name>Introduction</name>
      <t><xref target="RFC5280"/> defines a suite of extensions for determining the "policies" which
apply to a certification path. A policy is described by an object identifier
(OID), and a set of optional qualifiers.</t>
      <t>Policy validation in <xref target="RFC5280"/> is complex. As an overview, the certificate
policies extension (<xref section="4.2.1.4" sectionFormat="of" target="RFC5280"/>) describes the policies,
with optional qualifiers, under which an individual certificate was issued.
The policy mappings extension (<xref section="4.2.1.5" sectionFormat="of" target="RFC5280"/>) allows a
CA certificate to map its policy OIDs to other policy OIDs in certificates
that it issues. Subject to these mappings and other extensions, the certification
path's overall policy set is the intersection of policies asserted by each
certificate in the path, collecting the corresponding qualifiers.</t>
      <t>The procedure in <xref section="6.1" sectionFormat="of" target="RFC5280"/> determines this set in the course
of certification path validation. It does so by building a policy tree,
containing policies asserted by each certificate and mappings between
them. This tree can grow exponentially in the depth of the certification path,
which means an attacker, with a small input, can cause a path validator to
consume excessive memory and computational resources. This cost asymmetry
can lead to a denial-of-service vulnerability in X.509-based applications, such
as <xref target="CVE-2023-0464"/> and <xref target="CVE-2023-23524"/>.</t>
      <t><xref target="dos"/> describes this vulnerability. <xref target="policy-graph"/> describes the primary
mitigation for this vulnerability, a replacement for the policy tree structure.
<xref target="updates"/> provides updates to <xref target="RFC5280"/> which implement this change.
Finally, <xref target="other-mitigations"/> discusses alternative mitigation strategies for
X.509 applications.</t>
      <section anchor="summary-of-changes-from-rfc-5280">
        <name>Summary of Changes from RFC 5280</name>
        <t>The algorithm for processing certificate policies and policy mappings is
replaced with one which builds an equivalent, but much more efficient structure.
This new algorithm does not change the validity status of any certification
path, nor which certificate policies are valid for it.</t>
      </section>
    </section>
    <section anchor="conventions-and-definitions">
      <name>Conventions and Definitions</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 14 <xref target="RFC2119"/> <xref target="RFC8174"/>
when, and only when, they appear in all capitals, as shown here.</t>
    </section>
    <section anchor="dos">
      <name>Denial of Service Vulnerability</name>
      <t>This section discusses how the path validation algorithm defined in
<xref section="6.1.2" sectionFormat="of" target="RFC5280"/> can lead to a denial-of-service vulnerability in
X.509-based applications.</t>
      <section anchor="policy-trees">
        <name>Policy Trees</name>
        <t><xref section="6.1.2" sectionFormat="of" target="RFC5280"/> constructs the <tt>valid_policy_tree</tt>, a tree of
certificate policies, during certification path validation.
The nodes at any given depth in the tree correspond to
policies asserted by a certificate in the certification path. A node's
parent policy is the policy in the issuer certificate which was mapped to this
policy, and a node's children are the policies it was mapped to in the subject
certificate.</t>
        <t>For example, suppose a certification path contains:</t>
        <ul spacing="normal">
          <li>
            <t>An intermediate certificate which asserts policy OIDs OID1, OID2, and OID5.
It contains mappings OID1 to OID3, and OID1 to OID4.</t>
          </li>
          <li>
            <t>An end-entity certificate which asserts policy OIDs OID2, OID3, and OID6.</t>
          </li>
        </ul>
        <t>This would result in the tree shown in <xref target="basic-tree"/>. Note that OID5 and OID6
are not included or mapped across the whole path, so they do not appear in the
final structure.</t>

        <figure anchor="basic-tree">
          <name>An Example X.509 Policy Tree</name>
          <artset>
            <artwork type="svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="336" width="424" viewBox="0 0 424 336" class="diagram" text-anchor="middle" font-family="monospace" font-size="13px" stroke-linecap="round">
                <path d="M 152,160 L 152,224" fill="none" stroke="black"/>
                <path d="M 152,288 L 152,320" fill="none" stroke="black"/>
                <path d="M 200,232 L 200,280" fill="none" stroke="black"/>
                <path d="M 232,32 L 232,96" fill="none" stroke="black"/>
                <path d="M 256,160 L 256,224" fill="none" stroke="black"/>
                <path d="M 256,288 L 256,320" fill="none" stroke="black"/>
                <path d="M 312,160 L 312,224" fill="none" stroke="black"/>
                <path d="M 312,288 L 312,320" fill="none" stroke="black"/>
                <path d="M 328,32 L 328,96" fill="none" stroke="black"/>
                <path d="M 360,232 L 360,280" fill="none" stroke="black"/>
                <path d="M 416,160 L 416,224" fill="none" stroke="black"/>
                <path d="M 416,288 L 416,320" fill="none" stroke="black"/>
                <path d="M 232,32 L 328,32" fill="none" stroke="black"/>
                <path d="M 232,64 L 328,64" fill="none" stroke="black"/>
                <path d="M 232,96 L 328,96" fill="none" stroke="black"/>
                <path d="M 152,160 L 256,160" fill="none" stroke="black"/>
                <path d="M 312,160 L 416,160" fill="none" stroke="black"/>
                <path d="M 152,192 L 256,192" fill="none" stroke="black"/>
                <path d="M 312,192 L 416,192" fill="none" stroke="black"/>
                <path d="M 152,224 L 256,224" fill="none" stroke="black"/>
                <path d="M 312,224 L 416,224" fill="none" stroke="black"/>
                <path d="M 152,288 L 256,288" fill="none" stroke="black"/>
                <path d="M 312,288 L 416,288" fill="none" stroke="black"/>
                <path d="M 152,320 L 256,320" fill="none" stroke="black"/>
                <path d="M 312,320 L 416,320" fill="none" stroke="black"/>
                <path d="M 324,104 L 348,152" fill="none" stroke="black"/>
                <path d="M 220,152 L 244,104" fill="none" stroke="black"/>
                <polygon class="arrowhead" points="368,280 356,274.4 356,285.6" fill="black" transform="rotate(90,360,280)"/>
                <polygon class="arrowhead" points="356,152 344,146.4 344,157.6" fill="black" transform="rotate(63.43494882292201,348,152)"/>
                <polygon class="arrowhead" points="228,152 216,146.4 216,157.6" fill="black" transform="rotate(116.56505117707799,220,152)"/>
                <polygon class="arrowhead" points="208,280 196,274.4 196,285.6" fill="black" transform="rotate(90,200,280)"/>
                <g class="text">
                  <text x="112" y="52">Root:</text>
                  <text x="280" y="52">anyPolicy</text>
                  <text x="280" y="84">{anyPolicy}</text>
                  <text x="80" y="180">Intermediate:</text>
                  <text x="204" y="180">OID1</text>
                  <text x="364" y="180">OID2</text>
                  <text x="24" y="196">(OID5</text>
                  <text x="92" y="196">discarded)</text>
                  <text x="180" y="212">{OID3,</text>
                  <text x="232" y="212">OID4}</text>
                  <text x="364" y="212">{OID2}</text>
                  <text x="88" y="308">End-entity:</text>
                  <text x="204" y="308">OID3</text>
                  <text x="364" y="308">OID2</text>
                  <text x="24" y="324">(OID6</text>
                  <text x="92" y="324">discarded)</text>
                </g>
              </svg>
            </artwork>
            <artwork type="ascii-art"><![CDATA[
                            +-----------+
           Root:            | anyPolicy |
                            +-----------+
                            |{anyPolicy}|
                            +-----------+
                             /          \
                            /            \
                           v              v
                  +------------+      +------------+
   Intermediate:  |    OID1    |      |    OID2    |
(OID5 discarded)  +------------+      +------------+
                  |{OID3, OID4}|      |   {OID2}   |
                  +------------+      +------------+
                        |                   |
                        |                   |
                        v                   v
                  +------------+      +------------+
     End-entity:  |    OID3    |      |    OID2    |
(OID6 discarded)  +------------+      +------------+
]]></artwork>
          </artset>
        </figure>

        <t>The complete algorithm for building this structure is described in steps (d),
(e), and (f) of <xref section="6.1.3" sectionFormat="of" target="RFC5280"/>, steps (h), (i), (j) of <xref section="6.1.4" sectionFormat="of" target="RFC5280"/>, and steps (a), (b), and (g) of <xref section="6.1.5" sectionFormat="of" target="RFC5280"/>.</t>
      </section>
      <section anchor="exponential-growth">
        <name>Exponential Growth</name>
        <t>The <tt>valid_policy_tree</tt> grows exponentially in the worst case. In
step (d.1) of <xref section="6.1.3" sectionFormat="of" target="RFC5280"/>, a single policy P can produce
multiple child nodes if multiple issuer policies map to P. This can cause the
tree size to increase in size multiplicatively at each level.</t>
        <t>In particular, consider a certificate chain where every intermediate certificate
asserts policies OID1 and OID2, and then contains the full Cartesian product of
mappings:</t>
        <ul spacing="normal">
          <li>
            <t>OID1 maps to OID1</t>
          </li>
          <li>
            <t>OID1 maps to OID2</t>
          </li>
          <li>
            <t>OID2 maps to OID1</t>
          </li>
          <li>
            <t>OID2 maps to OID2</t>
          </li>
        </ul>
        <t>At each depth, the tree would double in size.
For example, if there are two intermediate certificates and one end-entity certificate, the resulting tree would be as depicted in <xref target="exponential-tree"/>.</t>
        <figure anchor="exponential-tree">
          <name>An Example X.509 Policy Tree with Exponential Growth</name>
          <artset>
            <artwork type="svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="448" width="576" viewBox="0 0 576 448" class="diagram" text-anchor="middle" font-family="monospace" font-size="13px" stroke-linecap="round">
                <path d="M 8,400 L 8,432" fill="none" stroke="black"/>
                <path d="M 24,288 L 24,352" fill="none" stroke="black"/>
                <path d="M 40,360 L 40,392" fill="none" stroke="black"/>
                <path d="M 64,400 L 64,432" fill="none" stroke="black"/>
                <path d="M 80,400 L 80,432" fill="none" stroke="black"/>
                <path d="M 104,160 L 104,224" fill="none" stroke="black"/>
                <path d="M 104,360 L 104,392" fill="none" stroke="black"/>
                <path d="M 128,288 L 128,352" fill="none" stroke="black"/>
                <path d="M 136,400 L 136,432" fill="none" stroke="black"/>
                <path d="M 152,400 L 152,432" fill="none" stroke="black"/>
                <path d="M 168,288 L 168,352" fill="none" stroke="black"/>
                <path d="M 184,360 L 184,392" fill="none" stroke="black"/>
                <path d="M 200,32 L 200,96" fill="none" stroke="black"/>
                <path d="M 208,160 L 208,224" fill="none" stroke="black"/>
                <path d="M 208,400 L 208,432" fill="none" stroke="black"/>
                <path d="M 224,400 L 224,432" fill="none" stroke="black"/>
                <path d="M 248,360 L 248,392" fill="none" stroke="black"/>
                <path d="M 272,288 L 272,352" fill="none" stroke="black"/>
                <path d="M 280,400 L 280,432" fill="none" stroke="black"/>
                <path d="M 296,400 L 296,432" fill="none" stroke="black"/>
                <path d="M 312,288 L 312,352" fill="none" stroke="black"/>
                <path d="M 328,360 L 328,392" fill="none" stroke="black"/>
                <path d="M 352,400 L 352,432" fill="none" stroke="black"/>
                <path d="M 368,400 L 368,432" fill="none" stroke="black"/>
                <path d="M 392,32 L 392,96" fill="none" stroke="black"/>
                <path d="M 392,160 L 392,224" fill="none" stroke="black"/>
                <path d="M 392,360 L 392,392" fill="none" stroke="black"/>
                <path d="M 416,288 L 416,352" fill="none" stroke="black"/>
                <path d="M 424,400 L 424,432" fill="none" stroke="black"/>
                <path d="M 440,400 L 440,432" fill="none" stroke="black"/>
                <path d="M 456,288 L 456,352" fill="none" stroke="black"/>
                <path d="M 472,360 L 472,392" fill="none" stroke="black"/>
                <path d="M 496,160 L 496,224" fill="none" stroke="black"/>
                <path d="M 496,400 L 496,432" fill="none" stroke="black"/>
                <path d="M 512,400 L 512,432" fill="none" stroke="black"/>
                <path d="M 536,360 L 536,392" fill="none" stroke="black"/>
                <path d="M 560,288 L 560,352" fill="none" stroke="black"/>
                <path d="M 568,400 L 568,432" fill="none" stroke="black"/>
                <path d="M 200,32 L 392,32" fill="none" stroke="black"/>
                <path d="M 200,64 L 392,64" fill="none" stroke="black"/>
                <path d="M 200,96 L 392,96" fill="none" stroke="black"/>
                <path d="M 104,160 L 208,160" fill="none" stroke="black"/>
                <path d="M 392,160 L 496,160" fill="none" stroke="black"/>
                <path d="M 104,192 L 208,192" fill="none" stroke="black"/>
                <path d="M 392,192 L 496,192" fill="none" stroke="black"/>
                <path d="M 104,224 L 208,224" fill="none" stroke="black"/>
                <path d="M 392,224 L 496,224" fill="none" stroke="black"/>
                <path d="M 24,288 L 128,288" fill="none" stroke="black"/>
                <path d="M 168,288 L 272,288" fill="none" stroke="black"/>
                <path d="M 312,288 L 416,288" fill="none" stroke="black"/>
                <path d="M 456,288 L 560,288" fill="none" stroke="black"/>
                <path d="M 24,320 L 128,320" fill="none" stroke="black"/>
                <path d="M 168,320 L 272,320" fill="none" stroke="black"/>
                <path d="M 312,320 L 416,320" fill="none" stroke="black"/>
                <path d="M 456,320 L 560,320" fill="none" stroke="black"/>
                <path d="M 24,352 L 128,352" fill="none" stroke="black"/>
                <path d="M 168,352 L 272,352" fill="none" stroke="black"/>
                <path d="M 312,352 L 416,352" fill="none" stroke="black"/>
                <path d="M 456,352 L 560,352" fill="none" stroke="black"/>
                <path d="M 8,400 L 64,400" fill="none" stroke="black"/>
                <path d="M 80,400 L 136,400" fill="none" stroke="black"/>
                <path d="M 152,400 L 208,400" fill="none" stroke="black"/>
                <path d="M 224,400 L 280,400" fill="none" stroke="black"/>
                <path d="M 296,400 L 352,400" fill="none" stroke="black"/>
                <path d="M 368,400 L 424,400" fill="none" stroke="black"/>
                <path d="M 440,400 L 496,400" fill="none" stroke="black"/>
                <path d="M 512,400 L 568,400" fill="none" stroke="black"/>
                <path d="M 8,432 L 64,432" fill="none" stroke="black"/>
                <path d="M 80,432 L 136,432" fill="none" stroke="black"/>
                <path d="M 152,432 L 208,432" fill="none" stroke="black"/>
                <path d="M 224,432 L 280,432" fill="none" stroke="black"/>
                <path d="M 296,432 L 352,432" fill="none" stroke="black"/>
                <path d="M 368,432 L 424,432" fill="none" stroke="black"/>
                <path d="M 440,432 L 496,432" fill="none" stroke="black"/>
                <path d="M 512,432 L 568,432" fill="none" stroke="black"/>
                <path d="M 188,232 L 212,280" fill="none" stroke="black"/>
                <path d="M 380,104 L 404,152" fill="none" stroke="black"/>
                <path d="M 484,232 L 508,280" fill="none" stroke="black"/>
                <path d="M 92,280 L 116,232" fill="none" stroke="black"/>
                <path d="M 188,152 L 212,104" fill="none" stroke="black"/>
                <path d="M 388,280 L 412,232" fill="none" stroke="black"/>
                <polygon class="arrowhead" points="544,392 532,386.4 532,397.6" fill="black" transform="rotate(90,536,392)"/>
                <polygon class="arrowhead" points="516,280 504,274.4 504,285.6" fill="black" transform="rotate(63.43494882292201,508,280)"/>
                <polygon class="arrowhead" points="480,392 468,386.4 468,397.6" fill="black" transform="rotate(90,472,392)"/>
                <polygon class="arrowhead" points="412,152 400,146.4 400,157.6" fill="black" transform="rotate(63.43494882292201,404,152)"/>
                <polygon class="arrowhead" points="400,392 388,386.4 388,397.6" fill="black" transform="rotate(90,392,392)"/>
                <polygon class="arrowhead" points="396,280 384,274.4 384,285.6" fill="black" transform="rotate(116.56505117707799,388,280)"/>
                <polygon class="arrowhead" points="336,392 324,386.4 324,397.6" fill="black" transform="rotate(90,328,392)"/>
                <polygon class="arrowhead" points="256,392 244,386.4 244,397.6" fill="black" transform="rotate(90,248,392)"/>
                <polygon class="arrowhead" points="220,280 208,274.4 208,285.6" fill="black" transform="rotate(63.43494882292201,212,280)"/>
                <polygon class="arrowhead" points="196,152 184,146.4 184,157.6" fill="black" transform="rotate(116.56505117707799,188,152)"/>
                <polygon class="arrowhead" points="192,392 180,386.4 180,397.6" fill="black" transform="rotate(90,184,392)"/>
                <polygon class="arrowhead" points="112,392 100,386.4 100,397.6" fill="black" transform="rotate(90,104,392)"/>
                <polygon class="arrowhead" points="100,280 88,274.4 88,285.6" fill="black" transform="rotate(116.56505117707799,92,280)"/>
                <polygon class="arrowhead" points="48,392 36,386.4 36,397.6" fill="black" transform="rotate(90,40,392)"/>
                <g class="text">
                  <text x="304" y="52">anyPolicy</text>
                  <text x="304" y="84">{anyPolicy}</text>
                  <text x="156" y="180">OID1</text>
                  <text x="444" y="180">OID2</text>
                  <text x="132" y="212">{OID1,</text>
                  <text x="184" y="212">OID2}</text>
                  <text x="420" y="212">{OID1,</text>
                  <text x="472" y="212">OID2}</text>
                  <text x="76" y="308">OID1</text>
                  <text x="220" y="308">OID2</text>
                  <text x="364" y="308">OID1</text>
                  <text x="508" y="308">OID2</text>
                  <text x="52" y="340">{OID1,</text>
                  <text x="104" y="340">OID2}</text>
                  <text x="196" y="340">{OID1,</text>
                  <text x="248" y="340">OID2}</text>
                  <text x="340" y="340">{OID1,</text>
                  <text x="392" y="340">OID2}</text>
                  <text x="484" y="340">{OID1,</text>
                  <text x="536" y="340">OID2}</text>
                  <text x="36" y="420">OID1</text>
                  <text x="108" y="420">OID2</text>
                  <text x="180" y="420">OID1</text>
                  <text x="252" y="420">OID2</text>
                  <text x="324" y="420">OID1</text>
                  <text x="396" y="420">OID2</text>
                  <text x="468" y="420">OID1</text>
                  <text x="540" y="420">OID2</text>
                </g>
              </svg>
            </artwork>
            <artwork type="ascii-art"><![CDATA[
                        +-----------------------+
                        |        anyPolicy      |
                        +-----------------------+
                        |       {anyPolicy}     |
                        +-----------------------+
                         /                     \
                        /                       \
                       v                         v
            +------------+                      +------------+
            |    OID1    |                      |    OID2    |
            +------------+                      +------------+
            |{OID1, OID2}|                      |{OID1, OID2}|
            +------------+                      +------------+
             /         \                          /         \
            /           \                        /           \
           v             v                      v             v
  +------------+    +------------+    +------------+    +------------+
  |    OID1    |    |    OID2    |    |    OID1    |    |    OID2    |
  +------------+    +------------+    +------------+    +------------+
  |{OID1, OID2}|    |{OID1, OID2}|    |{OID1, OID2}|    |{OID1, OID2}|
  +------------+    +------------+    +------------+    +------------+
    |       |         |       |         |       |         |       |
    v       v         v       v         v       v         v       v
+------+ +------+ +------+ +------+ +------+ +------+ +------+ +------+
| OID1 | | OID2 | | OID1 | | OID2 | | OID1 | | OID2 | | OID1 | | OID2 |
+------+ +------+ +------+ +------+ +------+ +------+ +------+ +------+
]]></artwork>
          </artset>
        </figure>
      </section>
      <section anchor="attack-vector">
        <name>Attack Vector</name>
        <t>An attacker can use the exponential growth to mount a denial-of-service attack against
an X.509-based application. The attacker sends certificate chain as in <xref target="exponential-growth"/> and
triggers the target application's certificate validation process. For example,
the target application may be a TLS <xref target="RFC8446"/> server that performs client
certificate validation. The target
application will consume far more resources processing the input than the
attacker consumed to send it, preventing it from servicing other clients.</t>
      </section>
    </section>
    <section anchor="avoiding-exponential-growth">
      <name>Avoiding Exponential Growth</name>
      <t>This document mitigates the denial-of-service vulnerability described in <xref target="dos"/>
by replacing the policy tree with a policy graph structure, described in this
section. The policy graph grows linearly instead of exponentially. This removes
the asymmetric cost in policy validation.</t>
      <t>X.509 implementations <bcp14>SHOULD</bcp14> perform policy validation by building a policy
graph, following the procedure described in <xref target="updates"/>. This replacement
procedure computes the same policies as in <xref target="RFC5280"/>, however one of the
outputs is in a different form. See <xref target="outputs"/> for details.
<xref target="other-mitigations"/> describes alternative mitigations for implementations that
depend on the original, exponential-sized output.</t>
      <section anchor="policy-graph">
        <name>Policy Graphs</name>
        <t>The tree structure from <xref target="RFC5280"/> is an unnecessarily inefficient
representation of a certification path's policy mappings. A single certificate
policy may correspond to multiple nodes, but each node is identical, with identical
children. This redundancy is the source of the exponential growth described in
<xref target="exponential-growth"/>.</t>
        <t>A policy graph is a directed acyclic graph of policy nodes.
Where <xref target="RFC5280"/> adds multiple duplicate nodes, a policy graph adds a single node with multiple parents.
See <xref target="updates"/> for the procedure for building this structure.
<xref target="exponential-tree-as-graph"/> shows the updated representation of the example in <xref target="exponential-tree"/>.</t>
        <figure anchor="exponential-tree-as-graph">
          <name>A More Efficient Representation of an X.509 Policy Tree</name>
          <artset>
            <artwork type="svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="576" width="248" viewBox="0 0 248 576" class="diagram" text-anchor="middle" font-family="monospace" font-size="13px" stroke-linecap="round">
                <path d="M 8,160 L 8,224" fill="none" stroke="black"/>
                <path d="M 8,336 L 8,400" fill="none" stroke="black"/>
                <path d="M 8,512 L 8,544" fill="none" stroke="black"/>
                <path d="M 48,232 L 48,328" fill="none" stroke="black"/>
                <path d="M 48,408 L 48,504" fill="none" stroke="black"/>
                <path d="M 80,32 L 80,96" fill="none" stroke="black"/>
                <path d="M 112,160 L 112,224" fill="none" stroke="black"/>
                <path d="M 112,336 L 112,400" fill="none" stroke="black"/>
                <path d="M 112,512 L 112,544" fill="none" stroke="black"/>
                <path d="M 136,160 L 136,224" fill="none" stroke="black"/>
                <path d="M 136,336 L 136,400" fill="none" stroke="black"/>
                <path d="M 136,512 L 136,544" fill="none" stroke="black"/>
                <path d="M 176,32 L 176,96" fill="none" stroke="black"/>
                <path d="M 192,232 L 192,328" fill="none" stroke="black"/>
                <path d="M 192,408 L 192,504" fill="none" stroke="black"/>
                <path d="M 240,160 L 240,224" fill="none" stroke="black"/>
                <path d="M 240,336 L 240,400" fill="none" stroke="black"/>
                <path d="M 240,512 L 240,544" fill="none" stroke="black"/>
                <path d="M 80,32 L 176,32" fill="none" stroke="black"/>
                <path d="M 80,64 L 176,64" fill="none" stroke="black"/>
                <path d="M 80,96 L 176,96" fill="none" stroke="black"/>
                <path d="M 8,160 L 112,160" fill="none" stroke="black"/>
                <path d="M 136,160 L 240,160" fill="none" stroke="black"/>
                <path d="M 8,192 L 112,192" fill="none" stroke="black"/>
                <path d="M 136,192 L 240,192" fill="none" stroke="black"/>
                <path d="M 8,224 L 112,224" fill="none" stroke="black"/>
                <path d="M 136,224 L 240,224" fill="none" stroke="black"/>
                <path d="M 8,336 L 112,336" fill="none" stroke="black"/>
                <path d="M 136,336 L 240,336" fill="none" stroke="black"/>
                <path d="M 8,368 L 112,368" fill="none" stroke="black"/>
                <path d="M 136,368 L 240,368" fill="none" stroke="black"/>
                <path d="M 8,400 L 112,400" fill="none" stroke="black"/>
                <path d="M 136,400 L 240,400" fill="none" stroke="black"/>
                <path d="M 8,512 L 112,512" fill="none" stroke="black"/>
                <path d="M 136,512 L 240,512" fill="none" stroke="black"/>
                <path d="M 8,544 L 112,544" fill="none" stroke="black"/>
                <path d="M 136,544 L 240,544" fill="none" stroke="black"/>
                <path d="M 100,408 L 148,504" fill="none" stroke="black"/>
                <path d="M 100,232 L 148,328" fill="none" stroke="black"/>
                <path d="M 172,104 L 196,152" fill="none" stroke="black"/>
                <path d="M 60,152 L 84,104" fill="none" stroke="black"/>
                <path d="M 100,328 L 148,232" fill="none" stroke="black"/>
                <path d="M 100,504 L 148,408" fill="none" stroke="black"/>
                <polygon class="arrowhead" points="200,504 188,498.4 188,509.6" fill="black" transform="rotate(90,192,504)"/>
                <polygon class="arrowhead" points="200,328 188,322.4 188,333.6" fill="black" transform="rotate(90,192,328)"/>
                <polygon class="arrowhead" points="204,152 192,146.4 192,157.6" fill="black" transform="rotate(63.43494882292201,196,152)"/>
                <polygon class="arrowhead" points="156,504 144,498.4 144,509.6" fill="black" transform="rotate(63.43494882292201,148,504)"/>
                <polygon class="arrowhead" points="156,328 144,322.4 144,333.6" fill="black" transform="rotate(63.43494882292201,148,328)"/>
                <polygon class="arrowhead" points="108,504 96,498.4 96,509.6" fill="black" transform="rotate(116.56505117707799,100,504)"/>
                <polygon class="arrowhead" points="108,328 96,322.4 96,333.6" fill="black" transform="rotate(116.56505117707799,100,328)"/>
                <polygon class="arrowhead" points="68,152 56,146.4 56,157.6" fill="black" transform="rotate(116.56505117707799,60,152)"/>
                <polygon class="arrowhead" points="56,504 44,498.4 44,509.6" fill="black" transform="rotate(90,48,504)"/>
                <polygon class="arrowhead" points="56,328 44,322.4 44,333.6" fill="black" transform="rotate(90,48,328)"/>
                <g class="text">
                  <text x="128" y="52">anyPolicy</text>
                  <text x="128" y="84">{anyPolicy}</text>
                  <text x="60" y="180">OID1</text>
                  <text x="188" y="180">OID2</text>
                  <text x="36" y="212">{OID1,</text>
                  <text x="88" y="212">OID2}</text>
                  <text x="164" y="212">{OID1,</text>
                  <text x="216" y="212">OID2}</text>
                  <text x="60" y="356">OID1</text>
                  <text x="188" y="356">OID2</text>
                  <text x="36" y="388">{OID1,</text>
                  <text x="88" y="388">OID2}</text>
                  <text x="164" y="388">{OID1,</text>
                  <text x="216" y="388">OID2}</text>
                  <text x="60" y="532">OID1</text>
                  <text x="188" y="532">OID2</text>
                </g>
              </svg>
            </artwork>
            <artwork type="ascii-art"><![CDATA[
              +-----------+
              | anyPolicy |
              +-----------+
              |{anyPolicy}|
              +-----------+
              /           \
             /             \
            v               v
     +------------+  +------------+
     |    OID1    |  |    OID2    |
     +------------+  +------------+
     |{OID1, OID2}|  |{OID1, OID2}|
     +------------+  +------------+
          |      \    /     |
          |       \  /      |
          |        \/       |
          |        /\       |
          |       /  \      |
          v      v    v     v
     +------------+  +------------+
     |    OID1    |  |    OID2    |
     +------------+  +------------+
     |{OID1, OID2}|  |{OID1, OID2}|
     +------------+  +------------+
          |      \    /     |
          |       \  /      |
          |        \/       |
          |        /\       |
          |       /  \      |
          v      v    v     v
     +------------+  +------------+
     |    OID1    |  |    OID2    |
     +------------+  +------------+
]]></artwork>
          </artset>
        </figure>
        <t>This graph's size is bounded linearly by the total number of certificate
policies (<xref section="4.2.1.4" sectionFormat="of" target="RFC5280"/>) and policy mappings (<xref section="4.2.1.5" sectionFormat="of" target="RFC5280"/>). The policy tree from <xref target="RFC5280"/> is the tree of all paths from the root to a leaf in the policy graph,
so no information is lost in the graph representation.</t>
      </section>
      <section anchor="outputs">
        <name>Verification Outputs</name>
        <t><xref section="6.1.6" sectionFormat="of" target="RFC5280"/> describes the entire <tt>valid_policy_tree</tt> structure as
an output of the verification process. Section 12.2 of <xref target="X.509"/> instead only
outputs the authorities-constrained policies, the user-constrained policies,
and their associated qualifiers.</t>
        <t>As the <tt>valid_policy_tree</tt> is the exponential structure, computing it
reintroduces the denial-of-service vulnerability. X.509 implementations
<bcp14>SHOULD NOT</bcp14> output the entire <tt>valid_policy_tree</tt> structure and instead <bcp14>SHOULD</bcp14>
limit output to just the set of authorities-constrained and/or user-constrained
policies, as described in <xref target="X.509"/>. <xref target="update-outputs"/> and
<xref target="other-mitigations"/> discuss other mitigations for applications where this
option is not available.</t>
        <t>X.509 implementations <bcp14>MAY</bcp14> omit policy qualifiers from the output to simplify
processing. Note <xref section="4.2.1.4" sectionFormat="of" target="RFC5280"/> already recommends that
certification authorities omit policy qualifiers from policy information terms.</t>
      </section>
    </section>
    <section anchor="updates">
      <name>Updates to RFC 5280</name>
      <t>This section provides updates to <xref target="RFC5280"/>. This implements the changes
described in <xref target="avoiding-exponential-growth"/>.</t>
      <section anchor="updates-to-section-61">
        <name>Updates to Section 6.1</name>
        <t>This update replaces a paragraph of <xref section="6.1" sectionFormat="of" target="RFC5280"/> as follows:</t>
        <t>OLD:</t>
        <ul empty="true">
          <li>
            <t>A particular certification path may not, however, be appropriate for
  all applications.  Therefore, an application <bcp14>MAY</bcp14> augment this
  algorithm to further limit the set of valid paths.  The path
  validation process also determines the set of certificate policies
  that are valid for this path, based on the certificate policies
  extension, policy mappings extension, policy constraints extension,
  and inhibit anyPolicy extension.  To achieve this, the path
  validation algorithm constructs a valid policy tree.  If the set of
  certificate policies that are valid for this path is not empty, then
  the result will be a valid policy tree of depth n, otherwise the
  result will be a null valid policy tree.</t>
          </li>
        </ul>
        <t>NEW:</t>
        <ul empty="true">
          <li>
            <t>A particular certification path may not, however, be appropriate for
  all applications.  Therefore, an application <bcp14>MAY</bcp14> augment this
  algorithm to further limit the set of valid paths.  The path
  validation process also determines the set of certificate policies
  that are valid for this path, based on the certificate policies
  extension, policy mappings extension, policy constraints extension,
  and inhibit anyPolicy extension.  To achieve this, the path
  validation algorithm constructs a valid policy set, which may be empty if
  no certificate policies are valid for this path.</t>
          </li>
        </ul>
      </section>
      <section anchor="updates-to-section-612">
        <name>Updates to Section 6.1.2</name>
        <t>This update replaces entry (a) of <xref section="6.1.2" sectionFormat="of" target="RFC5280"/> with the following text:</t>
        <ol spacing="normal" type="(%c)"><li>
            <t><tt>valid_policy_graph</tt>: A directed acyclic graph of
            certificate policies with their optional qualifiers; each of the
            leaves of the graph represents a valid policy at this stage in the
            certification path validation.  If valid policies exist at this
            stage in the certification path validation, the depth of the graph
            is equal to the number of certificates in the chain that have been
            processed.  If valid policies do not exist at this stage in the
            certification path validation, the graph is set to NULL.  Once the
            graph is set to NULL, policy processing ceases.  Implementations
            <bcp14>MAY</bcp14> omit qualifiers if not returned in the output.
            </t>
            <t>Each node in the <tt>valid_policy_graph</tt> includes three
            data objects: the valid policy, a set of associated policy
            qualifiers, and a set of one or more expected policy values.  </t>
            <t>Nodes in the graph can be divided into depths, numbered
            starting from zero.  A node at depth x can have zero or more
            children at depth x+1 and, with the exception of depth zero, one
            or more parents at depth x-1. No other edges between nodes may
            exist.  </t>
            <t>If the node is at depth x, the components of the node have the
            following semantics: </t>
            <ol spacing="normal" type="(%d)"><li>
                <t>The <tt>valid_policy</tt> is a single policy OID
                representing a valid policy for the path of length x.</t>
              </li>
              <li>
                <t>The <tt>qualifier_set</tt> is a set of policy qualifiers
                associated with the valid policy in certificate x.  It is only
                necessary to maintain this field if policy qualifiers are
                returned to the application.  See Section 6.1.5, step (g).</t>
              </li>
              <li>
                <t>The <tt>expected_policy_set</tt> contains one or more
                policy OIDs that would satisfy this policy in the certificate
                x+1.</t>
              </li>
            </ol>
            <t>The initial value of the <tt>valid_policy_graph</tt> is a
            single node with <tt>valid_policy</tt> anyPolicy, an empty
            <tt>qualifier_set</tt>, and an <tt>expected_policy_set</tt> with
            the single value anyPolicy.  This node is considered to be at
            depth zero.  </t>
            <t>The graph additionally satisfies the following invariants:  </t>
            <ul spacing="normal">
              <li>
                <t>For any depth x and policy OID P-OID, there is at most one
                node at depth x whose <tt>valid_policy</tt> is P-OID.</t>
              </li>
              <li>
                <t>The <tt>expected_policy_set</tt> of a node whose
                <tt>valid_policy</tt> is anyPolicy is always {anyPolicy}.</t>
              </li>
              <li>
                <t>A node at depth x whose <tt>valid_policy</tt> is anyPolicy,
                except for the one at depth zero, always has exactly one
                parent: a node at depth x-1 whose <tt>valid_policy</tt> is
                also anyPolicy.</t>
              </li>
              <li>
                <t>Each node at depth greater than 0 has either one or more
                parent nodes whose <tt>valid_policy</tt> is not anyPolicy, or
                a single parent node whose <tt>valid_policy</tt> is anyPolicy.
                That is, a node cannot simultaneously be a child of both
                anyPolicy and some non-anyPolicy OID.</t>
              </li>
            </ul>
            <t><xref target="graph-initial"/> is a graphic representation of
            the initial state of the <tt>valid_policy_graph</tt>.  Additional
            figures will use this format to describe changes in the
            <tt>valid_policy_graph</tt> during path processing.  </t>
            <figure anchor="graph-initial">
              <name>Initial value of the valid_policy_graph State Variable</name>
              <artset>
                <artwork type="svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="160" width="376" viewBox="0 0 376 160" class="diagram" text-anchor="middle" font-family="monospace" font-size="13px" stroke-linecap="round">
                    <path d="M 8,32 L 8,128" fill="none" stroke="black"/>
                    <path d="M 144,32 L 144,128" fill="none" stroke="black"/>
                    <path d="M 8,32 L 144,32" fill="none" stroke="black"/>
                    <path d="M 176,48 L 208,48" fill="none" stroke="black"/>
                    <path d="M 8,64 L 144,64" fill="none" stroke="black"/>
                    <path d="M 176,80 L 208,80" fill="none" stroke="black"/>
                    <path d="M 8,96 L 144,96" fill="none" stroke="black"/>
                    <path d="M 176,112 L 208,112" fill="none" stroke="black"/>
                    <path d="M 8,128 L 144,128" fill="none" stroke="black"/>
                    <polygon class="arrowhead" points="184,112 172,106.4 172,117.6" fill="black" transform="rotate(180,176,112)"/>
                    <polygon class="arrowhead" points="184,80 172,74.4 172,85.6" fill="black" transform="rotate(180,176,80)"/>
                    <polygon class="arrowhead" points="184,48 172,42.4 172,53.6" fill="black" transform="rotate(180,176,48)"/>
                    <g class="text">
                      <text x="72" y="52">anyPolicy</text>
                      <text x="268" y="52">valid_policy</text>
                      <text x="76" y="84">{}</text>
                      <text x="272" y="84">qualifier_set</text>
                      <text x="72" y="116">{anyPolicy}</text>
                      <text x="296" y="116">expected_policy_set</text>
                    </g>
                  </svg>
                </artwork>
                <artwork type="ascii-art"><![CDATA[
    +----------------+
    |   anyPolicy    |   <---- valid_policy
    +----------------+
    |       {}       |   <---- qualifier_set
    +----------------+
    |  {anyPolicy}   |   <---- expected_policy_set
    +----------------+
]]></artwork>
              </artset>
            </figure>
          </li>
        </ol>
      </section>
      <section anchor="updates-to-section-613">
        <name>Updates to Section 6.1.3</name>
        <t>This update replaces steps (d), (e), and (f) of <xref section="6.1.3" sectionFormat="of" target="RFC5280"/> with the following text:</t>
        <ol spacing="normal" type="(%c)" start="4"><li>
            <t>If the certificate policies extension is present in the
            certificate and the <tt>valid_policy_graph</tt> is not NULL,
            process the policy information by performing the following steps
            in order: </t>
            <ol spacing="normal" type="(%d)"><li>
                <t>For each policy P not equal to anyPolicy in the certificate
                policies extension, let P-OID denote the OID for policy P and
                P-Q denote the qualifier set for policy P.  Perform the
                following steps in order: </t>
                <ol spacing="normal" type="(%i)"><li>
                    <t>Let <tt>parent_nodes</tt> be the nodes at depth i-1 in
                    the <tt>valid_policy_graph</tt> where P-OID is in the
                    <tt>expected_policy_set</tt>.  If <tt>parent_nodes</tt> is
                    not empty, create a child node as follows: set the
                    <tt>valid_policy</tt> to P-OID, set the
                    <tt>qualifier_set</tt> to P-Q, set the
                    <tt>expected_policy_set</tt> to {P-OID}, and set the
                    parent nodes to <tt>parent_nodes</tt>.  </t>
                    <t>For example, consider a <tt>valid_policy_graph</tt>
                    with a node of depth i-1 where the
                    <tt>expected_policy_set</tt> is {Gold, White}, and a
                    second node where the <tt>expected_policy_set</tt> is
                    {Gold, Yellow}.  Assume the certificate policies Gold and
                    Silver appear in the certificate policies extension of
                    certificate i.  The Gold policy is matched, but the Silver
                    policy is not.  This rule will generate a child node of
                    depth i for the Gold policy.  The result is shown as <xref
                    target="exact-match"/>.  </t>
                    <figure anchor="exact-match">
                      <name>Processing an Exact Match</name>
                      <artset>
                        <artwork type="svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="336" width="456" viewBox="0 0 456 336" class="diagram" text-anchor="middle" font-family="monospace" font-size="13px" stroke-linecap="round">
                            <path d="M 8,32 L 8,128" fill="none" stroke="black"/>
                            <path d="M 112,208 L 112,304" fill="none" stroke="black"/>
                            <path d="M 152,32 L 152,128" fill="none" stroke="black"/>
                            <path d="M 208,32 L 208,128" fill="none" stroke="black"/>
                            <path d="M 256,208 L 256,304" fill="none" stroke="black"/>
                            <path d="M 352,32 L 352,128" fill="none" stroke="black"/>
                            <path d="M 8,32 L 152,32" fill="none" stroke="black"/>
                            <path d="M 208,32 L 352,32" fill="none" stroke="black"/>
                            <path d="M 8,64 L 152,64" fill="none" stroke="black"/>
                            <path d="M 208,64 L 352,64" fill="none" stroke="black"/>
                            <path d="M 8,96 L 152,96" fill="none" stroke="black"/>
                            <path d="M 208,96 L 352,96" fill="none" stroke="black"/>
                            <path d="M 8,128 L 152,128" fill="none" stroke="black"/>
                            <path d="M 208,128 L 352,128" fill="none" stroke="black"/>
                            <path d="M 112,208 L 256,208" fill="none" stroke="black"/>
                            <path d="M 112,240 L 256,240" fill="none" stroke="black"/>
                            <path d="M 112,272 L 256,272" fill="none" stroke="black"/>
                            <path d="M 112,304 L 256,304" fill="none" stroke="black"/>
                            <path d="M 100,136 L 132,200" fill="none" stroke="black"/>
                            <path d="M 236,200 L 268,136" fill="none" stroke="black"/>
                            <polygon class="arrowhead" points="244,200 232,194.4 232,205.6" fill="black" transform="rotate(116.56505117707799,236,200)"/>
                            <polygon class="arrowhead" points="140,200 128,194.4 128,205.6" fill="black" transform="rotate(63.43494882292201,132,200)"/>
                            <g class="text">
                              <text x="80" y="52">Red</text>
                              <text x="284" y="52">Blue</text>
                              <text x="76" y="84">{}</text>
                              <text x="276" y="84">{}</text>
                              <text x="400" y="84">depth</text>
                              <text x="440" y="84">i-1</text>
                              <text x="52" y="116">{Gold,</text>
                              <text x="108" y="116">White}</text>
                              <text x="252" y="116">{Gold,</text>
                              <text x="312" y="116">Yellow}</text>
                              <text x="180" y="228">Gold</text>
                              <text x="180" y="260">{}</text>
                              <text x="304" y="260">depth</text>
                              <text x="336" y="260">i</text>
                              <text x="180" y="292">{Gold}</text>
                            </g>
                          </svg>
                        </artwork>
                        <artwork type="ascii-art"><![CDATA[
    +-----------------+      +-----------------+
    |       Red       |      |       Blue      |
    +-----------------+      +-----------------+
    |       {}        |      |       {}        |   depth i-1
    +-----------------+      +-----------------+
    |  {Gold, White}  |      |  {Gold, Yellow} |
    +-----------------+      +-----------------+
                \                   /
                 \                 /
                  \               /
                   v             v
                 +-----------------+
                 |      Gold       |
                 +-----------------+
                 |       {}        |   depth i
                 +-----------------+
                 |     {Gold}      |
                 +-----------------+
]]></artwork>
                      </artset>
                    </figure>
                  </li>
                  <li>
                    <t>If there was no match in step (i) and the
                    <tt>valid_policy_graph</tt> includes a node of depth i-1
                    with the <tt>valid_policy</tt> anyPolicy, generate a child
                    node with the following values: set the
                    <tt>valid_policy</tt> to P-OID, set the
                    <tt>qualifier_set</tt> to P-Q, set the
                    <tt>expected_policy_set</tt> to {P-OID}, and set the
                    parent node to the anyPolicy node at depth i-1.  </t>
                    <t>For example, consider a <tt>valid_policy_graph</tt>
                    with a node of depth i-1 where the <tt>valid_policy</tt>
                    is anyPolicy.  Assume the certificate policies Gold and
                    Silver appear in the certificate policies extension of
                    certificate i.  The Gold policy does not have a qualifier,
                    but the Silver policy has the qualifier Q-Silver.  If Gold
                    and Silver were not matched in (i) above, this rule will
                    generate two child nodes of depth i, one for each policy.
                    The result is shown as <xref
                    target="unmatched-anypolicy"/>.  </t>
                    <figure anchor="unmatched-anypolicy">
                      <name>Processing Unmatched Policies when a Leaf Node Specifies anyPolicy</name>
                      <artset>
                        <artwork type="svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="336" width="472" viewBox="0 0 472 336" class="diagram" text-anchor="middle" font-family="monospace" font-size="13px" stroke-linecap="round">
                            <path d="M 8,208 L 8,304" fill="none" stroke="black"/>
                            <path d="M 120,32 L 120,128" fill="none" stroke="black"/>
                            <path d="M 152,208 L 152,304" fill="none" stroke="black"/>
                            <path d="M 240,208 L 240,304" fill="none" stroke="black"/>
                            <path d="M 264,32 L 264,128" fill="none" stroke="black"/>
                            <path d="M 384,208 L 384,304" fill="none" stroke="black"/>
                            <path d="M 120,32 L 264,32" fill="none" stroke="black"/>
                            <path d="M 120,64 L 264,64" fill="none" stroke="black"/>
                            <path d="M 120,96 L 264,96" fill="none" stroke="black"/>
                            <path d="M 120,128 L 264,128" fill="none" stroke="black"/>
                            <path d="M 8,208 L 152,208" fill="none" stroke="black"/>
                            <path d="M 240,208 L 384,208" fill="none" stroke="black"/>
                            <path d="M 8,240 L 152,240" fill="none" stroke="black"/>
                            <path d="M 240,240 L 384,240" fill="none" stroke="black"/>
                            <path d="M 8,272 L 152,272" fill="none" stroke="black"/>
                            <path d="M 240,272 L 384,272" fill="none" stroke="black"/>
                            <path d="M 8,304 L 152,304" fill="none" stroke="black"/>
                            <path d="M 240,304 L 384,304" fill="none" stroke="black"/>
                            <path d="M 236,136 L 268,200" fill="none" stroke="black"/>
                            <path d="M 116,200 L 148,136" fill="none" stroke="black"/>
                            <polygon class="arrowhead" points="276,200 264,194.4 264,205.6" fill="black" transform="rotate(63.43494882292201,268,200)"/>
                            <polygon class="arrowhead" points="124,200 112,194.4 112,205.6" fill="black" transform="rotate(116.56505117707799,116,200)"/>
                            <g class="text">
                              <text x="192" y="52">anyPolicy</text>
                              <text x="188" y="84">{}</text>
                              <text x="312" y="100">depth</text>
                              <text x="352" y="100">i-1</text>
                              <text x="192" y="116">{anyPolicy}</text>
                              <text x="76" y="228">Gold</text>
                              <text x="308" y="228">Silver</text>
                              <text x="76" y="260">{}</text>
                              <text x="308" y="260">{Q-Silver}</text>
                              <text x="432" y="260">depth</text>
                              <text x="464" y="260">i</text>
                              <text x="76" y="292">{Gold}</text>
                              <text x="308" y="292">{Silver}</text>
                            </g>
                          </svg>
                        </artwork>
                        <artwork type="ascii-art"><![CDATA[
                  +-----------------+
                  |    anyPolicy    |
                  +-----------------+
                  |       {}        |
                  +-----------------+   depth i-1
                  |   {anyPolicy}   |
                  +-----------------+
                     /           \
                    /             \
                   /               \
                  v                 v
    +-----------------+          +-----------------+
    |      Gold       |          |     Silver      |
    +-----------------+          +-----------------+
    |       {}        |          |   {Q-Silver}    |   depth i
    +-----------------+          +-----------------+
    |     {Gold}      |          |    {Silver}     |
    +-----------------+          +-----------------+
]]></artwork>
                      </artset>
                    </figure>
                  </li>
                </ol>
              </li>
              <li>
                <t>If the certificate policies extension includes the policy
                anyPolicy with the qualifier set AP-Q and either (a)
                <tt>inhibit_anyPolicy</tt> is greater than 0 or (b) i&lt;n and
                the certificate is self-issued, then: </t>
                <t>For each policy OID P-OID (including anyPolicy) which
                appears in the <tt>expected_policy_set</tt> of some node in
                the <tt>valid_policy_graph</tt> for depth i-1, if P-OID does
                not appear as the <tt>valid_policy</tt> of some node at depth
                i, create a single child node with the following values: set
                the <tt>valid_policy</tt> to P-OID, set the
                <tt>qualifier_set</tt> to AP-Q, set the
                <tt>expected_policy_set</tt> to {P-OID}, and set the parents
                to the nodes at depth i-1 where P-OID appears in
                <tt>expected_policy_set</tt>.  </t>
                <t>
This is equivalent to running step (1) above, as if the certificate policies extension contained a policy with OID P-OID and qualifier set AP-Q.      </t>
                <t>
For example, consider a <tt>valid_policy_graph</tt> with a node of depth i-1 where the <tt>expected_policy_set</tt> is {Gold, Silver},
and a second node of depth i-1 where the <tt>expected_policy_set</tt> is {Gold}.
Assume anyPolicy appears in the certificate policies extension of certificate i with policy qualifiers AP-Q, but Gold and Silver do not appear.
This rule will generate two child nodes of depth i, one for each policy.
The result is shown below as <xref target="anypolicy-in-extension"/>.      </t>
                <figure anchor="anypolicy-in-extension">
                  <name>Processing Unmatched Policies When the Certificate Policies Extension Specifies anyPolicy</name>
                  <artset>
                    <artwork type="svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="368" width="432" viewBox="0 0 432 368" class="diagram" text-anchor="middle" font-family="monospace" font-size="13px" stroke-linecap="round">
                        <path d="M 8,32 L 8,128" fill="none" stroke="black"/>
                        <path d="M 8,240 L 8,336" fill="none" stroke="black"/>
                        <path d="M 72,136 L 72,232" fill="none" stroke="black"/>
                        <path d="M 152,32 L 152,128" fill="none" stroke="black"/>
                        <path d="M 152,240 L 152,336" fill="none" stroke="black"/>
                        <path d="M 184,32 L 184,128" fill="none" stroke="black"/>
                        <path d="M 184,240 L 184,336" fill="none" stroke="black"/>
                        <path d="M 256,136 L 256,232" fill="none" stroke="black"/>
                        <path d="M 328,32 L 328,128" fill="none" stroke="black"/>
                        <path d="M 328,240 L 328,336" fill="none" stroke="black"/>
                        <path d="M 8,32 L 152,32" fill="none" stroke="black"/>
                        <path d="M 184,32 L 328,32" fill="none" stroke="black"/>
                        <path d="M 8,64 L 152,64" fill="none" stroke="black"/>
                        <path d="M 184,64 L 328,64" fill="none" stroke="black"/>
                        <path d="M 8,96 L 152,96" fill="none" stroke="black"/>
                        <path d="M 184,96 L 328,96" fill="none" stroke="black"/>
                        <path d="M 8,128 L 152,128" fill="none" stroke="black"/>
                        <path d="M 184,128 L 328,128" fill="none" stroke="black"/>
                        <path d="M 8,240 L 152,240" fill="none" stroke="black"/>
                        <path d="M 184,240 L 328,240" fill="none" stroke="black"/>
                        <path d="M 8,272 L 152,272" fill="none" stroke="black"/>
                        <path d="M 184,272 L 328,272" fill="none" stroke="black"/>
                        <path d="M 8,304 L 152,304" fill="none" stroke="black"/>
                        <path d="M 184,304 L 328,304" fill="none" stroke="black"/>
                        <path d="M 8,336 L 152,336" fill="none" stroke="black"/>
                        <path d="M 184,336 L 328,336" fill="none" stroke="black"/>
                        <path d="M 148,136 L 196,232" fill="none" stroke="black"/>
                        <polygon class="arrowhead" points="264,232 252,226.4 252,237.6" fill="black" transform="rotate(90,256,232)"/>
                        <polygon class="arrowhead" points="204,232 192,226.4 192,237.6" fill="black" transform="rotate(63.43494882292201,196,232)"/>
                        <polygon class="arrowhead" points="80,232 68,226.4 68,237.6" fill="black" transform="rotate(90,72,232)"/>
                        <g class="text">
                          <text x="80" y="52">Red</text>
                          <text x="260" y="52">Blue</text>
                          <text x="76" y="84">{}</text>
                          <text x="252" y="84">{}</text>
                          <text x="376" y="84">depth</text>
                          <text x="416" y="84">i-1</text>
                          <text x="52" y="116">{Gold,</text>
                          <text x="112" y="116">Silver}</text>
                          <text x="260" y="116">{Gold}</text>
                          <text x="76" y="260">Silver</text>
                          <text x="260" y="260">Gold</text>
                          <text x="76" y="292">{AP-Q}</text>
                          <text x="260" y="292">{AP-Q}</text>
                          <text x="376" y="292">depth</text>
                          <text x="408" y="292">i</text>
                          <text x="76" y="324">{Silver}</text>
                          <text x="260" y="324">{Gold}</text>
                        </g>
                      </svg>
                    </artwork>
                    <artwork type="ascii-art"><![CDATA[
    +-----------------+   +-----------------+
    |       Red       |   |       Blue      |
    +-----------------+   +-----------------+
    |       {}        |   |       {}        |   depth i-1
    +-----------------+   +-----------------+
    |  {Gold, Silver} |   |      {Gold}     |
    +-----------------+   +-----------------+
            |         \            |
            |          \           |
            |           \          |
            |            \         |
            |             \        |
            v              v       v
    +-----------------+   +-----------------+
    |     Silver      |   |       Gold      |
    +-----------------+   +-----------------+
    |     {AP-Q}      |   |      {AP-Q}     |   depth i
    +-----------------+   +-----------------+
    |    {Silver}     |   |      {Gold}     |
    +-----------------+   +-----------------+
]]></artwork>
                  </artset>
                </figure>
              </li>
              <li>
                <t>If there is a node in the <tt>valid_policy_graph</tt> of depth i-1 or less without any child nodes, delete that node.
Repeat this step until there are no nodes of depth i-1 or less without children.      </t>
                <t>
For example, consider the valid_policy_graph shown in <xref target="pruning"/> below.
The two nodes at depth i-1 that are marked with an 'X' have no children, and they are deleted.
Applying this rule to the resulting graph will cause the nodes at depth i-2 that is marked with a 'Y' to be deleted.
In the resulting graph, there are no nodes of depth i-1 or less without children, and this step is complete.      </t>
                <figure anchor="pruning">
                  <name>Pruning the valid_policy_graph</name>
                  <artset>
                    <artwork type="svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="384" width="416" viewBox="0 0 416 384" class="diagram" text-anchor="middle" font-family="monospace" font-size="13px" stroke-linecap="round">
                        <path d="M 8,128 L 8,160" fill="none" stroke="black"/>
                        <path d="M 8,224 L 8,256" fill="none" stroke="black"/>
                        <path d="M 8,320 L 8,352" fill="none" stroke="black"/>
                        <path d="M 56,168 L 56,216" fill="none" stroke="black"/>
                        <path d="M 104,128 L 104,160" fill="none" stroke="black"/>
                        <path d="M 104,224 L 104,256" fill="none" stroke="black"/>
                        <path d="M 104,320 L 104,352" fill="none" stroke="black"/>
                        <path d="M 120,32 L 120,64" fill="none" stroke="black"/>
                        <path d="M 120,128 L 120,160" fill="none" stroke="black"/>
                        <path d="M 120,224 L 120,256" fill="none" stroke="black"/>
                        <path d="M 120,320 L 120,352" fill="none" stroke="black"/>
                        <path d="M 168,72 L 168,120" fill="none" stroke="black"/>
                        <path d="M 168,168 L 168,216" fill="none" stroke="black"/>
                        <path d="M 168,264 L 168,312" fill="none" stroke="black"/>
                        <path d="M 216,32 L 216,64" fill="none" stroke="black"/>
                        <path d="M 216,128 L 216,160" fill="none" stroke="black"/>
                        <path d="M 216,224 L 216,256" fill="none" stroke="black"/>
                        <path d="M 216,320 L 216,352" fill="none" stroke="black"/>
                        <path d="M 232,128 L 232,160" fill="none" stroke="black"/>
                        <path d="M 232,224 L 232,256" fill="none" stroke="black"/>
                        <path d="M 232,320 L 232,352" fill="none" stroke="black"/>
                        <path d="M 280,168 L 280,216" fill="none" stroke="black"/>
                        <path d="M 328,128 L 328,160" fill="none" stroke="black"/>
                        <path d="M 328,224 L 328,256" fill="none" stroke="black"/>
                        <path d="M 328,320 L 328,352" fill="none" stroke="black"/>
                        <path d="M 120,32 L 216,32" fill="none" stroke="black"/>
                        <path d="M 120,64 L 216,64" fill="none" stroke="black"/>
                        <path d="M 8,128 L 104,128" fill="none" stroke="black"/>
                        <path d="M 120,128 L 216,128" fill="none" stroke="black"/>
                        <path d="M 232,128 L 328,128" fill="none" stroke="black"/>
                        <path d="M 8,160 L 104,160" fill="none" stroke="black"/>
                        <path d="M 120,160 L 216,160" fill="none" stroke="black"/>
                        <path d="M 232,160 L 328,160" fill="none" stroke="black"/>
                        <path d="M 8,224 L 104,224" fill="none" stroke="black"/>
                        <path d="M 120,224 L 216,224" fill="none" stroke="black"/>
                        <path d="M 232,224 L 328,224" fill="none" stroke="black"/>
                        <path d="M 8,256 L 104,256" fill="none" stroke="black"/>
                        <path d="M 120,256 L 216,256" fill="none" stroke="black"/>
                        <path d="M 232,256 L 328,256" fill="none" stroke="black"/>
                        <path d="M 8,320 L 104,320" fill="none" stroke="black"/>
                        <path d="M 120,320 L 216,320" fill="none" stroke="black"/>
                        <path d="M 232,320 L 328,320" fill="none" stroke="black"/>
                        <path d="M 8,352 L 104,352" fill="none" stroke="black"/>
                        <path d="M 120,352 L 216,352" fill="none" stroke="black"/>
                        <path d="M 232,352 L 328,352" fill="none" stroke="black"/>
                        <path d="M 100,168 L 124,216" fill="none" stroke="black"/>
                        <path d="M 212,264 L 236,312" fill="none" stroke="black"/>
                        <path d="M 212,72 L 236,120" fill="none" stroke="black"/>
                        <path d="M 100,120 L 124,72" fill="none" stroke="black"/>
                        <path d="M 100,312 L 124,264" fill="none" stroke="black"/>
                        <polygon class="arrowhead" points="288,216 276,210.4 276,221.6" fill="black" transform="rotate(90,280,216)"/>
                        <polygon class="arrowhead" points="244,312 232,306.4 232,317.6" fill="black" transform="rotate(63.43494882292201,236,312)"/>
                        <polygon class="arrowhead" points="244,120 232,114.4 232,125.6" fill="black" transform="rotate(63.43494882292201,236,120)"/>
                        <polygon class="arrowhead" points="176,312 164,306.4 164,317.6" fill="black" transform="rotate(90,168,312)"/>
                        <polygon class="arrowhead" points="176,216 164,210.4 164,221.6" fill="black" transform="rotate(90,168,216)"/>
                        <polygon class="arrowhead" points="176,120 164,114.4 164,125.6" fill="black" transform="rotate(90,168,120)"/>
                        <polygon class="arrowhead" points="132,216 120,210.4 120,221.6" fill="black" transform="rotate(63.43494882292201,124,216)"/>
                        <polygon class="arrowhead" points="108,312 96,306.4 96,317.6" fill="black" transform="rotate(116.56505117707799,100,312)"/>
                        <polygon class="arrowhead" points="108,120 96,114.4 96,125.6" fill="black" transform="rotate(116.56505117707799,100,120)"/>
                        <polygon class="arrowhead" points="64,216 52,210.4 52,221.6" fill="black" transform="rotate(90,56,216)"/>
                        <g class="text">
                          <text x="248" y="52">depth</text>
                          <text x="288" y="52">i-3</text>
                          <text x="280" y="148">Y</text>
                          <text x="360" y="148">depth</text>
                          <text x="400" y="148">i-2</text>
                          <text x="56" y="244">X</text>
                          <text x="280" y="244">X</text>
                          <text x="360" y="244">depth</text>
                          <text x="400" y="244">i-1</text>
                          <text x="360" y="340">depth</text>
                          <text x="392" y="340">i</text>
                        </g>
                      </svg>
                    </artwork>
                    <artwork type="ascii-art"><![CDATA[
                  +-----------+
                  |           | depth i-3
                  +-----------+
                  /     |     \
                 /      |      \
                v       v       v
    +-----------+ +-----------+ +-----------+
    |           | |           | |     Y     | depth i-2
    +-----------+ +-----------+ +-----------+
          |     \       |             |
          |      \      |             |
          v       v     v             v
    +-----------+ +-----------+ +-----------+
    |     X     | |           | |     X     | depth i-1
    +-----------+ +-----------+ +-----------+
                  /     |     \
                 /      |      \
                v       v       v
    +-----------+ +-----------+ +-----------+
    |           | |           | |           | depth i
    +-----------+ +-----------+ +-----------+
]]></artwork>
                  </artset>
                </figure>
              </li>
            </ol>
          </li>
          <li>
            <t>If the certificate policies extension is not present, set the <tt>valid_policy_graph</tt> to NULL.</t>
          </li>
          <li>
            <t>Verify that either <tt>explicit_policy</tt> is greater than 0 or the <tt>valid_policy_graph</tt> is not equal to NULL;</t>
          </li>
        </ol>
      </section>
      <section anchor="updates-to-section-614">
        <name>Updates to Section 6.1.4</name>
        <t>This update replaces step (b) of <xref section="6.1.4" sectionFormat="of" target="RFC5280"/> with the following text:</t>
        <ol spacing="normal" type="(%c)" start="2"><li>
            <t>If a policy mappings extension is present, then for each issuerDomainPolicy ID-P in the policy mappings extension:  </t>
            <ol spacing="normal" type="(%d)"><li>
                <t>If the policy_mapping variable is greater than 0 and there is a
node in the <tt>valid_policy_graph</tt> of depth i where ID-P is the
valid_policy, set <tt>expected_policy_set</tt> to the set of
subjectDomainPolicy values that are specified as
equivalent to ID-P by the policy mappings extension.</t>
              </li>
              <li>
                <t>If the policy_mapping variable is greater than 0,
no node of depth i in the <tt>valid_policy_graph</tt> has a
<tt>valid_policy</tt> of ID-P, but there is a node of depth i with a
<tt>valid_policy</tt> of anyPolicy, then generate a child node of
the node of depth i-1 that has a <tt>valid_policy</tt> of anyPolicy
as follows:      </t>
                <ol spacing="normal" type="(%i)"><li>
                    <t>set the <tt>valid_policy</tt> to ID-P;</t>
                  </li>
                  <li>
                    <t>set the <tt>qualifier_set</tt> to the qualifier set of the
policy anyPolicy in the certificate policies
extension of certificate i; and</t>
                  </li>
                  <li>
                    <t>set the <tt>expected_policy_set</tt> to the set of
subjectDomainPolicy values that are specified as
equivalent to ID-P by the policy mappings extension.</t>
                  </li>
                </ol>
              </li>
              <li>
                <t>If the <tt>policy_mapping</tt> variable is equal to 0:      </t>
                <ol spacing="normal" type="(%i)"><li>
                    <t>delete the node, if any, of depth i in the <tt>valid_policy_graph</tt> where ID-P is the <tt>valid_policy</tt>.</t>
                  </li>
                  <li>
                    <t>If there is a node in the <tt>valid_policy_graph</tt> of depth
i-1 or less without any child nodes, delete that
node.  Repeat this step until there are no nodes of
depth i-1 or less without children.</t>
                  </li>
                </ol>
              </li>
            </ol>
          </li>
        </ol>
      </section>
      <section anchor="updates-to-section-615">
        <name>Updates to Section 6.1.5</name>
        <t>This update replaces step (g) of <xref section="6.1.5" sectionFormat="of" target="RFC5280"/> with the following text:</t>
        <ol spacing="normal" type="(%c)" start="7"><li>
            <t>Calculate the <tt>user_constrained_policy_set</tt> as follows.
The <tt>user_constrained_policy_set</tt> is a set of policy OIDs, along with associated policy qualifiers.  </t>
            <ol spacing="normal" type="(%d)"><li>
                <t>If the <tt>valid_policy_graph</tt> is NULL, set <tt>valid_policy_node_set</tt> to the empty set.</t>
              </li>
              <li>
                <t>If the <tt>valid_policy_graph</tt> is not NULL, set <tt>valid_policy_node_set</tt> to the set of policy nodes
whose <tt>valid_policy</tt> is not anyPolicy and
whose parent list is a single node with <tt>valid_policy</tt> of anyPolicy.</t>
              </li>
              <li>
                <t>If the <tt>valid_policy_graph</tt> is not NULL and contains a node of depth n with the <tt>valid_policy</tt> anyPolicy, add it to <tt>valid_policy_node_set</tt>.</t>
              </li>
              <li>
                <t>Compute <tt>authority_constrained_policy_set</tt>, a set of policy OIDs and associated qualifiers as follows. For each node in <tt>valid_policy_node_set</tt>:      </t>
                <ol spacing="normal" type="(%i)"><li>
                    <t>Add the node's <tt>valid_policy</tt> to <tt>authority_constrained_policy_set</tt>.</t>
                  </li>
                  <li>
                    <t>Collect all qualifiers in the node, its ancestors, and descendants and associate them with <tt>valid_policy</tt>. Applications that do not use policy qualifiers <bcp14>MAY</bcp14> skip this step to simplify processing.</t>
                  </li>
                </ol>
              </li>
              <li>
                <t>Set <tt>user_constrained_policy_set</tt> to <tt>authority_constrained_policy_set</tt>.</t>
              </li>
              <li>
                <t>If the user-initial-policy-set is not anyPolicy:      </t>
                <ol spacing="normal" type="(%i)"><li>
                    <t>Remove any elements of <tt>user_constrained_policy_set</tt> which do not appear in user-initial-policy-set.</t>
                  </li>
                  <li>
                    <t>If anyPolicy appears in <tt>authority_constrained_policy_set</tt> with qualifiers AP-Q, for each OID P-OID in user-initial-policy-set which does not appear in <tt>user_constrained_policy_set</tt>, add P-OID with qualifiers AP-Q to <tt>user_constrained_policy_set</tt>.</t>
                  </li>
                </ol>
              </li>
            </ol>
          </li>
        </ol>
        <t>Additionally, this update replaces the final paragraph as follows:</t>
        <t>OLD:</t>
        <ul empty="true">
          <li>
            <t>If either (1) the value of <tt>explicit_policy</tt> variable is greater than
zero or (2) the <tt>valid_policy_tree</tt> is not NULL, then path processing
has succeeded.</t>
          </li>
        </ul>
        <t>NEW:</t>
        <ul empty="true">
          <li>
            <t>If either (1) the value of <tt>explicit_policy</tt> is greater than
zero or (2) the <tt>user_constrained_policy_set</tt> is not empty, then path processing
has succeeded.</t>
          </li>
        </ul>
      </section>
      <section anchor="update-outputs">
        <name>Updates to Section 6.1.6</name>
        <t>This update replaces <xref section="6.1.6" sectionFormat="of" target="RFC5280"/> with the following text:</t>
        <ul empty="true">
          <li>
            <t>If path processing succeeds, the procedure terminates, returning a
success indication together with final value of the <tt>user_constrained_policy_set</tt>,
the <tt>working_public_key</tt>, the <tt>working_public_key_algorithm</tt>, and the
<tt>working_public_key_parameters</tt>.</t>
            <t>Note the original procedure described in <xref target="RFC5280"/> included a
<tt>valid_policy_tree</tt> structure as part of the output. This structure grows
exponentially in the size of the input, so computing it risks
denial-of-service vulnerabilities in X.509-based applications, such as
<xref target="CVE-2023-0464"/> and <xref target="CVE-2023-23524"/>. Accordingly, this output is
deprecated. Computing this structure is <bcp14>NOT RECOMMENDED</bcp14>.</t>
            <t>An implementation which requires <tt>valid_policy_tree</tt> for compatibility with
legacy systems may compute it from <tt>valid_policy_graph</tt> by recursively
duplicating every multi-parent node. This may be done on-demand when the
calling application first requests this output. However, this computation may
consume exponential time and memory, so such implementations <bcp14>SHOULD</bcp14> mitigate
denial-of-service in other ways, such as limiting the depth or size of the
tree.</t>
          </li>
        </ul>
      </section>
    </section>
    <section anchor="other-mitigations">
      <name>Other Mitigations</name>
      <t>X.509 implementations that are unable switch to the policy graph structure
<bcp14>SHOULD</bcp14> mitigate the denial-of-service attack in other ways. This section
describes alternate mitigation and partial mitigation strategies.</t>
      <section anchor="verify-signatures-first">
        <name>Verify Signatures First</name>
        <t>X.509 validators <bcp14>SHOULD</bcp14> verify signatures in certification paths before or in
conjunction with policy verification. This limits the attack to entities in
control of CA certificates. For some applications, this may be sufficient to
mitigate the attack. However, other applications may still be impacted. For
example:</t>
        <ul spacing="normal">
          <li>
            <t>Any application that evaluates an untrusted PKI, such as a hosting provider
that evaluates a customer-supplied PKI</t>
          </li>
          <li>
            <t>Any application that evaluates an otherwise trusted PKI, but where untrusted
entities have technically-constrained intermediate certificates where policy
mapping and path length are unconstrained.</t>
          </li>
        </ul>
      </section>
      <section anchor="limit-certificate-depth">
        <name>Limit Certificate Depth</name>
        <t>The policy tree grows exponentially in the depth of a certification path, so
limiting the depth and certificate size can mitigate the attack.</t>
        <t>However, this option may not be viable for all applications. Too low of a limit
may reject existing paths which the application wishes to accept. Too high of a
limit may still admit a DoS attack for the application. By modifying the example
in <xref target="exponential-growth"/> to increase the number of policies asserted in each
certificate, an attacker could still achieve O(N^(depth/2)) scaling.</t>
      </section>
      <section anchor="limit-policy-tree-size">
        <name>Limit Policy Tree Size</name>
        <t>The attack can be mitigated by limiting the number of nodes in the policy tree,
and rejecting the certification path if this limit is reached. This limit should
be set high enough to still admit existing valid certification paths for the
application, but low enough to no longer admit a DoS attack.</t>
      </section>
      <section anchor="inhibit-policy-mapping">
        <name>Inhibit Policy Mapping</name>
        <t>If policy mapping is disabled via the initial-policy-mapping-inhibit setting
(see <xref section="6.1.1" sectionFormat="of" target="RFC5280"/>), the attack is mitigated. This also
significantly simplifies the X.509 implementation, which reduces the risk of
other security bugs. However, this will break compatibility with any existing
certification paths which rely on policy mapping.</t>
        <t>To facilitate this mitigation, certificate authorities <bcp14>SHOULD NOT</bcp14> issue
certificates with the policy mappings extension (<xref section="4.2.1.5" sectionFormat="of" target="RFC5280"/>). Applications maintaining policies for accepted trust anchors are
<bcp14>RECOMMENDED</bcp14> to forbid this extension in participating certificate authorities.</t>
      </section>
      <section anchor="disable-policy-checking">
        <name>Disable Policy Checking</name>
        <t>An X.509 validator can mitigate this attack by disabling policy validation
entirely. This may be viable for applications which do not require policy
validation. In this case, critical policy-related extensions, notably the policy
constraints (<xref section="4.2.1.11" sectionFormat="of" target="RFC5280"/>), <bcp14>MUST</bcp14> be treated as unrecognized
extensions as in <xref section="4.2" sectionFormat="of" target="RFC5280"/> and be rejected.</t>
      </section>
    </section>
    <section removeInRFC="true" anchor="implementation-status">
      <name>Implementation Status</name>
      <t>This section records the status of known implementations of the
protocol defined by this specification at the time of posting of
this Internet-Draft, and is based on a proposal described in
RFC 7942.  The description of implementations in this section is
intended to assist the IETF in its decision processes in
progressing drafts to RFCs.  Please note that the listing of any
individual implementation here does not imply endorsement by the
IETF.  Furthermore, no effort has been spent to verify the
information presented here that was supplied by IETF contributors.
This is not intended as, and must not be construed to be, a
catalog of available implementations or their features.  Readers
are advised to note that other implementations may exist.</t>
      <t>According to RFC 7942, "this will allow reviewers and working
groups to assign due consideration to documents that have the
benefit of running code, which may serve as evidence of valuable
experimentation and feedback that have made the implemented
protocols more mature.  It is up to the individual working groups
to use this information as they see fit".</t>
      <t>The following projects adopted the concept outlined in this document:</t>
      <ul spacing="normal">
        <li>
          <t><xref target="BoringSSL"/></t>
        </li>
        <li>
          <t><xref target="LibreSSL"/></t>
        </li>
      </ul>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t><xref target="dos"/> discusses how <xref target="RFC5280"/>'s policy tree algorithm can lead to
denial-of-service vulnerabilities in X.509-based applications, such as
<xref target="CVE-2023-0464"/> and <xref target="CVE-2023-23524"/>.</t>
      <t><xref target="updates"/> replaces this algorithm to avoid this issue. As discussed in
<xref target="policy-graph"/>, the new structure scales linearly with the input. This means
input limits in X.509 validators will more naturally bound processing time,
thus avoiding these vulnerabilities.</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>This document has no IANA actions.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references anchor="sec-normative-references">
        <name>Normative References</name>

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

      </references>
      <references anchor="sec-informative-references">
        <name>Informative References</name>

<!-- [rfced] [X.509] Found https://www.itu.int/rec/T-REC-X.509-->
        <reference anchor="X.509">
          <front>
            <title>Information technology - Open Systems Interconnection - The Directory: Public-key and attribute certificate frameworks</title>
            <author>
              <organization>International Telecommunications Union</organization>
            </author>
            <date year="2019" month="October"/>
          </front>
          <seriesInfo name="ITU-T" value="Recommendation X.509"/>
        </reference>

<!-- [rfced] [CVE-2023-0464] URL is correct -->
        <reference anchor="CVE-2023-0464" target="https://www.cve.org/CVERecord?id=CVE-2023-0464">
          <front>
            <title>Excessive Resource Usage Verifying X.509 Policy Constraints</title>
            <author>
              <organization/>
            </author>
            <date year="2023" month="March"/>
          </front>
        </reference>

<!-- [rfced] [CVE-2023-23524] URL is correct -->
        <reference anchor="CVE-2023-23524" target="https://www.cve.org/CVERecord?id=CVE-2023-23524">
          <front>
            <title>Processing a maliciously crafted certificate may lead to a denial-of-service</title>
            <author>
              <organization/>
            </author>
            <date year="2023" month="February"/>
          </front>
        </reference>

<!-- [rfced] [BoringSSL] URL is correct -->
        <reference anchor="BoringSSL" target="https://boringssl.googlesource.com/boringssl">
          <front>
            <title>BoringSSL</title>
            <author>
              <organization/>
            </author>
            <date year="2024" month="January"/>
          </front>
        </reference>

<!-- [rfced] [LibreSSL] URL is correct -->
        <reference anchor="LibreSSL" target="https://www.libressl.org/">
          <front>
            <title>LibreSSL</title>
            <author>
              <organization/>
            </author>
            <date year="2024" month="January"/>
          </front>
        </reference>

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

      </references>
    </references>


<section numbered="false" anchor="acknowledgements">
      <name>Acknowledgements</name>
      <t>The author thanks <contact fullname="Bob Beck"/>, <contact
      fullname="Adam Langley"/>, <contact fullname="Matt Mueller"/>, and
      <contact fullname="Ryan Sleevi"/> for many valuable discussions that led
      to discovering this issue, understanding it, and developing the
      mitigation. The author also thanks <contact fullname="Martin Thomson"/>
      and <contact fullname="Job Snijders"/> for feedback on this
      document.</t>
    </section>
  </back>

</rfc>
