-
Notifications
You must be signed in to change notification settings - Fork 18k
crypto/x509: can set pathlen in certificate when not CA #38216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Milestone
Comments
Yes this looks like something we should fix. Let's aim for 1.15. Thanks for filing the issue. /cc @FiloSottile if you want to comment further |
Change https://golang.org/cl/228777 mentions this issue: |
Change https://golang.org/cl/235280 mentions this issue: |
gopherbot
pushed a commit
that referenced
this issue
May 26, 2020
This fixes a bug in CL 228777 which disallowed a MaxPathLen of -1 without IsCA, even though the x509.Certificate documentation indicates that MaxPathLen of -1 is considered "unset". Updates #38216 Change-Id: Ib7240e00408d060f27567be8b820d0eee239256f Reviewed-on: https://go-review.googlesource.com/c/go/+/235280 Run-TryBot: Katie Hockman <katie@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
RFC 5280 prohibits setting path lengths when not a CA.
From section 4.2.1.9
CAs MUST NOT include the pathLenConstraint field unless the cA
boolean is asserted and the key usage extension asserts the
keyCertSign bit.
This isn't restricted by the library, and means you can create invalid certificates. These are now failing checks in the latest version of OpenSSL (openssl/openssl#11456)
The relevant code is around
go/src/crypto/x509/x509.go
Line 1746 in 801cd7c
Something like
if !template.IsCA {
maxPathLen = -1
}
would probably fix, but I'm not an expert in either Go or security, so don't want to change critical code.
The text was updated successfully, but these errors were encountered: