Skip to content

NameConstraints: support wildcard SAN#10549

Merged
douzzer merged 1 commit into
wolfSSL:masterfrom
rizlik:nc_dns_wildcards
Jun 4, 2026
Merged

NameConstraints: support wildcard SAN#10549
douzzer merged 1 commit into
wolfSSL:masterfrom
rizlik:nc_dns_wildcards

Conversation

@rizlik

@rizlik rizlik commented May 28, 2026

Copy link
Copy Markdown
Contributor

Description

Proper NameConstraint checking in case of wildcard in the SAN DNS types

Copilot AI review requested due to automatic review settings May 28, 2026 09:30
@rizlik rizlik self-assigned this May 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds correct RFC 5280 nameConstraints handling for wildcard DNS SANs and fixes URI host constraint semantics so constraints without a leading . are treated as exact-host matches (not subtrees), strengthening certificate verification behavior.

Changes:

  • Normalize trailing-dot DNS names for nameConstraints comparisons and add label-wise wildcard DNS SAN vs subtree matching.
  • Update URI nameConstraint matching to apply DNS-subtree behavior only for constraints that begin with .; otherwise require exact host match.
  • Add unit tests for the new matchers plus an end-to-end chain-verification regression test covering DNS/URI wildcard scenarios.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
wolfssl/wolfcrypt/asn.h Exposes new local test-visible helpers for URI constraints and wildcard DNS constraint matching.
wolfcrypt/src/asn.c Implements trailing-dot normalization for DNS constraints, exports URI constraint matcher, and adds wildcard-aware DNS subtree matching logic.
tests/api/test_asn.h Registers new ASN matcher unit tests.
tests/api/test_asn.c Adds targeted unit tests for DNS wildcard constraint matching and URI host constraint semantics.
tests/api.c Adds an end-to-end regression test verifying DNS/URI nameConstraints enforcement via real chain verification.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread wolfcrypt/src/asn.c
Comment thread tests/api/test_asn.c Outdated
@rizlik rizlik force-pushed the nc_dns_wildcards branch from 8274aa1 to c4b4e6c Compare May 28, 2026 13:19
@rizlik rizlik marked this pull request as ready for review May 28, 2026 13:44
@github-actions

Copy link
Copy Markdown

retest this please

@rizlik rizlik requested a review from kareem-wolfssl June 1, 2026 06:31
@rizlik rizlik assigned wolfSSL-Bot and unassigned rizlik Jun 1, 2026
@rizlik rizlik requested a review from gasbytes June 1, 2026 06:32
@douzzer douzzer merged commit 4993571 into wolfSSL:master Jun 4, 2026
579 of 580 checks passed

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #10549

Scan targets checked: wolfcrypt-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread wolfcrypt/src/asn.c
}
else {
int i;
if (hostSz != baseSz) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 [Medium] URI exact-host constraints skip trailing-dot normalization · X.509 and ASN.1 parsing vulnerabilities

wolfssl_local_MatchUriNameConstraint() performs exact URI-host matching before stripping the DNS absolute-name trailing dot, so https://host.com./ does not match an excluded host.com constraint and the chain is accepted.

Fix: Normalize one trailing dot from both hostStart/hostSz and base/baseSz before the exact-host length and byte comparison.

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.

7 participants