$ the-wire · showcase
crypto/x509 tightens URI and email name constraint matching
By RepoJournal · Filed · About Go
Three crypto/x509 commits from Daniel McCarney align name-constraint handling with RFC 5280, restricting URI and email constraints to exact hosts and rejecting empty GeneralSubtrees sequences.
crypto/x509 now applies host constraint matching to URI name constraints instead of DNS subtree matching [1]. Previously "example.com" matched subdomains; it now matches only the exact host, while constraints with a leading period keep domain-wide behavior. This also stops treating "*."-prefixed URI hosts as DNS wildcards for excluded constraints. The same treatment extends to email constraints: a bare email constraint without an @ or leading period now matches mailboxes at one exact host rather than all subdomains [2]. Matching preserves sorted lookup and pruning, distinguishing exact hosts from leading-period domain constraints.
The verifier now rejects NameConstraints extensions when either permittedSubtrees or excludedSubtrees is present with an empty sequence [3]. Previously only a fully empty extension was rejected. The change aligns with BoringSSL's pki verifier, and the x509-limbo corpus adds coverage for the new and existing behaviors [4]. In a separate cmd/go fix, vet export data is now preserved in memory for dependent actions when a package fails diagnostics, ensuring downstream vetting and testing proceed correctly [5].
Action items
References
- [1] crypto/x509: restrict URI constraints to exact hosts ↗ golang/go
- [2] crypto/x509: restrict bare email constraints to exact hosts ↗ golang/go
- [3] crypto/x509: reject empty GeneralSubtrees sequences ↗ golang/go
- [4] crypto/x509: update x509-limbo tests ↗ golang/go
- [5] cmd/go: preserve vet export data in memory for dependent actions on failure ↗ golang/go