Skip to content

Reject IPv6 literal URIs in name constraint checking#3045

Merged
justsmth merged 2 commits intoaws:mainfrom
justsmth:reject-ipv6-uris
Mar 13, 2026
Merged

Reject IPv6 literal URIs in name constraint checking#3045
justsmth merged 2 commits intoaws:mainfrom
justsmth:reject-ipv6-uris

Conversation

@justsmth
Copy link
Copy Markdown
Contributor

Description of changes:

nc_uri searches for : as a port delimiter when extracting the host from a URI. For IPv6 literals like https://[2001:db8::1]/, this matches the first : inside the address, truncating the host to [2001. This bug was inherited from OpenSSL 1.1.1.

This change adds an explicit rejection of IPv6 literal URIs as unsupported syntax. RFC 5280 §4.2.1.10 says URI name constraints must be FQDNs anyway, and string comparison would be unreliable since the same IPv6 address can be written many different ways.

For URIs, the constraint applies to the host part of the name. The
constraint MUST be specified as a fully qualified domain name and MAY
specify a host or a domain.

The old behavior was already fail-closed (truncated hosts never matched real constraints), so this just makes it explicit.

Call-outs:

This intentionally does not add IPv6 literal matching support — doing it correctly would require address normalization.

Testing:

Two new cases in X509Test.NameConstraints: one well-formed and one malformed IPv6 literal URI, both expecting X509_V_ERR_UNSUPPORTED_NAME_SYNTAX. All 121 existing X509/X509Compat tests pass.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

skmcgrail
skmcgrail previously approved these changes Feb 25, 2026
samuel40791765
samuel40791765 previously approved these changes Mar 5, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.36%. Comparing base (ec37c27) to head (8f2892b).
⚠️ Report is 29 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3045      +/-   ##
==========================================
- Coverage   78.38%   78.36%   -0.02%     
==========================================
  Files         689      689              
  Lines      121200   121205       +5     
  Branches    16979    16982       +3     
==========================================
- Hits        95001    94984      -17     
- Misses      25304    25324      +20     
- Partials      895      897       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sgmenda sgmenda self-assigned this Mar 6, 2026
@justsmth justsmth merged commit fed51c3 into aws:main Mar 13, 2026
451 of 455 checks passed
@justsmth justsmth deleted the reject-ipv6-uris branch March 13, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants