RFC 5280 §4.2.1.10 when spec'ing Name Constraints for the 5280 profie says:
The name constraints extension, which MUST be used only in a CA certificate
This is tested by the x509-limbo rfc5280::nc::not-allowed-in-ee-noncritical and rfc5280::nc::not-allowed-in-ee-critical testcases.
Go crypto/x509 should enforce these requirements when verifying a leaf certificate so that the x509-limbo test cases produce the expected results.
Separately, it may be worth considering whether the x509.CreateCertificate function should also be updated to error if the provided template includes name constraints, but is not a CA certificate.
Relates to #65085 https://go-review.googlesource.com/c/go/+/783980
RFC 5280 §4.2.1.10 when spec'ing Name Constraints for the 5280 profie says:
This is tested by the
x509-limborfc5280::nc::not-allowed-in-ee-noncritical and rfc5280::nc::not-allowed-in-ee-critical testcases.Go crypto/x509 should enforce these requirements when verifying a leaf certificate so that the x509-limbo test cases produce the expected results.
Separately, it may be worth considering whether the
x509.CreateCertificatefunction should also be updated to error if the provided template includes name constraints, but is not a CA certificate.Relates to #65085 https://go-review.googlesource.com/c/go/+/783980