-
Notifications
You must be signed in to change notification settings - Fork 103
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
client/comms: check for non-standard compliant error #2130
Conversation
What precise go version? |
See also https://go-review.googlesource.com/c/go/+/460896/2/src/crypto/x509/root_darwin.go#61 |
Go version: 1.20.1 |
What do you think? Do you suggest we do something like this instead? |
We should do a combination of things.:
|
What I mean about this is, why are we even bothering with Lines 161 to 171 in c6a4c34
I suspect all would work fine for you if we juts used |
I think this is the reason: https://github.com/golang/go/blob/master/src/crypto/x509/verify.go#L767-#L784
While |
Anyway, can you link to the test that uses no cert and what it's expected to do? |
We are currently unable to catch extra |
Right, I just wanted to see why we're giving a nil cert. In this case what "test no cert error" really means is see if the system cert store has it. So this test really depends on the system. We still need to do the fixes in #2130 (comment). |
Does |
Yup:
Regardless, it's an error from x509 and retrying isn't going to help. |
Okay. EDIT:
Done in a88f34b |
On a related note, I've just observed this issue happening for the first time today on my Mac too:
It seems to have disappeared after restarting Mac, but not right after restart (I tried, it was still there) - more like 1h after. Looks more like Mac-specific (or maybe golang-specific) issue anyway, nothing to do here, just leaving it for anyone hitting in the future. I'm running |
32e8a40
to
b792587
Compare
Wow, so it affects host names with certificates signed by trusted root CAs. That's messed up. Literally nothing we can do about that, esp. within the eth I suggest updating your Go version though. |
Will you also please try this on your end? diff --git a/client/comms/wsconn.go b/client/comms/wsconn.go
index fb1a8123e..b118873a0 100644
--- a/client/comms/wsconn.go
+++ b/client/comms/wsconn.go
@@ -174,11 +174,7 @@ func NewWsConn(cfg *WsCfg) (WsConn, error) {
return nil, fmt.Errorf("error parsing URL: %w", err)
}
- rootCAs, _ := x509.SystemCertPool()
- if rootCAs == nil {
- rootCAs = x509.NewCertPool()
- }
-
+ rootCAs := x509.NewCertPool()
if ok := rootCAs.AppendCertsFromPEM(cfg.Cert); !ok {
return nil, ErrInvalidCert
} If the user is specifying a certificate to use, I don't see a point in appending it to the SystemCertPool. |
I will check. But I don't think it would make any difference. I haven't had any issues with the system verifier when a cert is provided. |
I wouldn't expect it to affect the nil cert test case. |
Well, since it does not change anything for mac(the invalid cert errors have been handled in this PR already). I think it's best we continue to use Unless there's a reason a particular reason we shouldn't. |
Labeling for 0.6 since it's a show stopper for a subset of mac users. |
This seems to be a known issue on some versions of
MacOS
orOS X
where an error:x509: “invalid-cert-name” certificate is not standards compliant
is returned. Since we cannot check the error type usingerrors.Is
orerrors.As
, this PR checks if the returned error contains the known error messagecertificate is not standards compliant
.Users could run varying versions of
macOS
and could be affected by this issue. This PR will ensure that a retry loop is not started because the cert is consideredInvalid
.Issue: golang/go#51991
For more context, I use
macOS
and was a bit flustered thatTestWsConn
kept failing, so I had to investigate.