<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en" style='--code-editor-font: var(--default-mono-font, "GitLab Mono"), JetBrains Mono, Menlo, DejaVu Sans Mono, Liberation Mono, Consolas, Ubuntu Mono, Courier New, andale mono, lucida console, monospace;'>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>
GitLab
</title>

<style data-premailer="ignore" type="text/css">
a { color: #1068bf; }
</style>

<style>img {
max-width: 100%; height: auto;
}
body {
font-size: .875rem;
}
body {
-webkit-text-shadow: hsla(0,0%,100%,.01) 0 0 1px;
}
body {
font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; font-size: inherit;
}
</style>
</head>
<body style='font-size: inherit; -webkit-text-shadow: hsla(0,0%,100%,.01) 0 0 1px; font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";'>
<div class="content">

<p class="details" style="font-style: italic; color: #626168;">
Issue created by <a href="https://gitlab.com/rates37">Satya Jhaveri</a>: <a href="https://gitlab.com/gnutls/gnutls/-/work_items/1893">#1893</a>
</p>
<div class="md" style="position: relative; z-index: 1; color: #3a383f; word-wrap: break-word;">
<h2 id="user-content-description" dir="auto" style="margin-top: 0px; margin-bottom: 10px;" align="initial">Description:<a href="#description" aria-label="Link to heading 'Description:'" data-heading-content="Description:" class="anchor" style="margin-top: 0px;"></a>
</h2>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">The default of 16 for max verify depth is too low for some real-world chains.</p>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">The constraint is triggered in <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;'>_gnutls_x509_cert_verify_peers</code>:</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre data-canonical-lang="c" class="code highlight js-syntax-highlight language-c" v-pre="true" style='display: block; font-size: 14px; color: #3a383f; line-height: 1.6em; overflow-x: auto; border-radius: .25rem; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; margin: 0px 0 1rem; padding: 12px; border: 1px solid #dcdcde;'><code style='font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: .25rem; white-space: pre; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; overflow-wrap: normal; padding: unset;'><span id="LC1" class="line" lang="c" style="margin-top: 0px;"><span class="k" style="margin-top: 0px;">if</span> <span class="p">(</span><span class="n">info</span><span class="o">-></span><span class="n">ncerts</span> <span class="o">></span> <span class="n">cred</span><span class="o">-></span><span class="n">verify_depth</span> <span class="o">&&</span> <span class="n">cred</span><span class="o">-></span><span class="n">verify_depth</span> <span class="o">></span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span></span>
<span id="LC2" class="line" lang="c">       <span class="n" style="margin-top: 0px;">gnutls_assert</span><span class="p">();</span></span>
<span id="LC3" class="line" lang="c">       <span class="k" style="margin-top: 0px;">return</span> <span class="n">GNUTLS_E_CONSTRAINT_ERROR</span><span class="p">;</span></span>
<span id="LC4" class="line" lang="c"><span class="p" style="margin-top: 0px;">}</span></span></code></pre>
<copy-code></copy-code><insert-code-snippet></insert-code-snippet>
</div>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">A chain with more than 16 certificates causes <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;'>GNUTLS_E_CONSTRAINT_ERROR</code> (-101),which surfaces to applications as a verification failure.</p>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">The value of 16 is used as a defense against DOS attacks. I'm asking what the motivation for the choice of 16 as a threshold is. OpenSSL defaults to 100, and there are legitimate chains that exceed 16 certificates in length. A limit of 100 still provides meaningful DoS protection, while avoiding breaking real-world deployments. I'd welcome the maintainer's view on where the right balance for this lies.</p>
<h2 id="user-content-version-of-gnutls-used-373" dir="auto" style="margin-top: 20px; margin-bottom: 10px;" align="initial">Version of gnutls used: 3.73<a href="#version-of-gnutls-used-373" aria-label="Link to heading 'Version of gnutls used: 3.73'" data-heading-content="Version of gnutls used: 3.73" class="anchor" style="margin-top: 0px;"></a>
</h2>
<h2 id="user-content-distributor-of-gnutls-ubuntu-22045-lts" dir="auto" style="margin-top: 20px; margin-bottom: 10px;" align="initial">Distributor of gnutls: Ubuntu (22.04.5 LTS)<a href="#distributor-of-gnutls-ubuntu-22045-lts" aria-label="Link to heading 'Distributor of gnutls: Ubuntu (22.04.5 LTS)'" data-heading-content="Distributor of gnutls: Ubuntu (22.04.5 LTS)" class="anchor" style="margin-top: 0px;"></a>
</h2>
<h2 id="user-content-how-reproducible" dir="auto" style="margin-top: 20px; margin-bottom: 10px;" align="initial">How reproducible:<a href="#how-reproducible" aria-label="Link to heading 'How reproducible:'" data-heading-content="How reproducible:" class="anchor" style="margin-top: 0px;"></a>
</h2>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">Steps to Reproduce:</p>
<ul dir="auto" style="text-align: initial; list-style-type: disc; margin: 0px; padding: 0;">
<li style="margin-top: 0px; line-height: 1.6em; margin-left: 25px; padding-left: 3px;">Generate a root CA, an intermediate CA cross-signed by over 16 alternate roots, and a leaf certificate</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">Serve the full chain and attempt to connect via any client using GnuTLS</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">The connection will fail with error -101</li>
</ul>
</div>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #626168;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/work_items/1893">view it on GitLab</a>.
<br>
You're receiving this email because of your account on <a target="_blank" rel="noopener noreferrer" href="https://gitlab.com">gitlab.com</a>. <a href="https://gitlab.com/-/sent_notifications/5-dg2eqoezg1ux5bhi6aa4sztdk-a84t7/unsubscribe" target="_blank" rel="noopener noreferrer">Unsubscribe</a> from this thread · <a href="https://gitlab.com/-/profile/notifications" target="_blank" rel="noopener noreferrer" class="mng-notif-link">Manage all notifications</a> · <a href="https://gitlab.com/help" target="_blank" rel="noopener noreferrer" class="help-link">Help</a>
<span style="color: transparent; font-size: 0; display: none; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0;">
Notification message regarding https://gitlab.com/gnutls/gnutls/-/work_items/1893 at 1779977520
</span>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Work item","url":"https://gitlab.com/gnutls/gnutls/-/work_items/1893"}}</script>


</p>
</div>
</body>
</html>