Skip to content

tests: check ancestor name constraints on chains - #1395

Open
ejohnstown wants to merge 1 commit into
wolfSSL:masterfrom
ejohnstown:certman-name-constraints
Open

ejohnstown wants to merge 1 commit into
wolfSSL:masterfrom
ejohnstown:certman-name-constraints

Conversation

@ejohnstown

@ejohnstown ejohnstown commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

A leaf below a peer-supplied subordinate CA must still meet the name
constraints of the CAs above it. wolfSSL enforces this from 5.9.4, and
this adds a regression test for it that needs no cert generation.

  • a constrained root, a CA excluding a subtree, and three leaves, with a
    script to regenerate them; configure links them for VPATH builds
  • verifies as server and client; the out-of-namespace and excluded
    leaves fail, alone and in the chain, and wolfSSL itself must reject
    them with ASN_NAME_INVALID_E

Issue: F-13950

@ejohnstown
ejohnstown force-pushed the certman-name-constraints branch from 728b656 to d2f0c87 Compare November 16, 2026 19:08
A leaf below a peer-supplied subordinate CA must still meet the name
constraints of the CAs above that CA. The test verifies a three-cert
chain under a constrained root as both server and client. It needs
wolfSSL 5.9.4 or later, but not cert generation.

- keys/nc-*.der: constrained root, CA excluding a subtree, CA, 3 leaves;
  gen-nameconstraints.sh regenerates them, configure links them
- leaf in the permitted subtree verifies; leaves outside it and in the
  excluded subtree are rejected, alone and within the chain
- wolfSSL must reject each bad leaf with ASN_NAME_INVALID_E, so a
  broken fixture cannot pass as a rejection
- add WOLFSSL_V5_9_4 to internal.h

Issue: F-13950
@ejohnstown

Copy link
Copy Markdown
Contributor Author

@claude review

@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 #1395

Scan targets checked: wolfssh-src, wolfssh-bugs
Not reviewed (no scan target covers them): configure.ac, keys/gen-nameconstraints.sh, keys/include.am, keys/nc-ca-a.der, keys/nc-ca-b.der, keys/nc-leaf-excl.der, keys/nc-leaf-in.der, keys/nc-leaf-out.der, keys/nc-root.der
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Max

@claude claude 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.

LGTM. This is a test-only regression change, and it doesn't touch any wolfSSH library code.

What was reviewed:

  • The new WOLFSSH_TEST_CERTMAN_NAMECONSTRAINTS guard. LIBWOLFSSL_VERSION_HEX and WOLFSSL_V5_9_4 are both defined by the time the guard is reached. Moving certmanPutU32, certmanAppendCert and CERTMAN_LEAF_USAGE_OK into the shared PROMOTE||NAMECONSTRAINTS block doesn't leave any duplicate definitions or unused-function gaps.
  • certmanNameConstraintsCase. Its cleanup paths and chain-buffer bounds look right (the chain is under 1.5 KB against a 4096-byte buffer). The lone-leaf pass relies on the intermediates that the 3-cert pass stores in the manager.
  • The six nc-*.der fixtures are registered in both configure.ac AC_CONFIG_LINKS and keys/include.am EXTRA_DIST. I could not open the DER contents here, so I haven't checked them against gen-nameconstraints.sh. The test's own wolfSSL ASN_NAME_INVALID_E check covers this when it runs.
Extended reasoning...

The change adds a unit test in tests/unit.c, six ECDSA P-256 DER fixtures, an openssl script to regenerate them, build wiring in configure.ac and keys/include.am, and one version constant in wolfssh/internal.h. It exercises certificate chain verification, which is security-sensitive, but it doesn't change any verification code. It only adds coverage behind a wolfSSL >= 5.9.4 guard. The helper moves are mechanical and match the existing guard conventions. No CODEOWNERS file covers these paths, and the timeline shows no outstanding reviewer objections.

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.

3 participants