-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
crypto/x509: AppendCertsFromPEM fails on go1.10rc1 #23711
Comments
This looks like the commit that changed the behavior:
found with |
AppendCertsFromPEM hides errors. The actual error is
This is probably working as intended. @agl? |
@bradfitz Yes, changing the name to a DNS pattern like Maybe add something to the release notes? Feel free to close this. |
PEM, in general, tries to pull out certificates or private keys embedded in basically anything. Thus it'll blow through all sorts of PEM syntax errors looking for something valid. In that vein, AppendCertsFromPEM also ignores certificate parsing errors and carries on to try and find something valid. That may have been a bridge too far and I can certainly see that, once we find a valid PEM block with the correct type, errors should be bubbled up. If others agree, I can cook up that change. (Although it's someone else's call whether it makes 1.10.) But, otherwise, it's unfortunate that we allowed invalid DNS names to survive for so long. But, to make the name constraints code sane, an invariant was needed that DNS names in parsed certificates look vaguely DNS-like. |
Change https://golang.org/cl/92635 mentions this issue: |
Change https://golang.org/cl/96378 mentions this issue: |
Go 1.10 requires that SANs in certificates are valid. However, a non-trivial number of (generally non-WebPKI) certificates have invalid strings in dnsName fields and some have even put those dnsName SANs in CA certificates. This change defers validity checking until name constraints are checked. Fixes #23995, #23711. Change-Id: I2e0ebb0898c047874a3547226b71e3029333b7f1 Reviewed-on: https://go-review.googlesource.com/96378 Run-TryBot: Adam Langley <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
Change https://golang.org/cl/102783 mentions this issue: |
…l addresses. Go 1.10 requires that SANs in certificates are valid. However, a non-trivial number of (generally non-WebPKI) certificates have invalid strings in dnsName fields and some have even put those dnsName SANs in CA certificates. This change defers validity checking until name constraints are checked. Fixes #23995, #23711. Change-Id: I2e0ebb0898c047874a3547226b71e3029333b7f1 Reviewed-on: https://go-review.googlesource.com/96378 Run-TryBot: Adam Langley <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-on: https://go-review.googlesource.com/102783 Run-TryBot: Andrew Bonventre <[email protected]> Reviewed-by: Filippo Valsorda <[email protected]>
When testing fabio with go1.10rc1 I've stumbled over a failing test (fabiolb/fabio#434)
I've traced it down to a call to
AppendCertsFromPEM
failing with a certificate that works fine in go1.9.2. The cert was created using the HashiCorp Vault PKI backend. I've included one of the certs in a full test case below.I've checked for a note in https://tip.golang.org/doc/go1.10#library but couldn't find anything obvious. Please let me know if I missed something.
What version of Go are you using (
go version
)?go1.10rc1
Does this issue reproduce with the latest release?
yes, checked master a0222ec
What operating system and processor architecture are you using (
go env
)?darwin_amd64 on macOS 10.13.3
What did you do?
see test case
Update 1: updated the test app to be git bisect friendly
The text was updated successfully, but these errors were encountered: