Remove incorrect certificate warning - #149
Conversation
javax.net.ssl.SSLHandshakeException can be thrown for a variety of reasons that are not related to the certificate being invalid, most notably socket errors while trying to negotate the TLS session. This can result in spurious warnings about the remote host serving an invalid certificate when a connection is closed, and can easily be triggered by a network change.
0399caa to
226d727
Compare
|
Would it be possible for someone to take a look at this? The issue still occurs sporadically and I've heard nothing in response since signing the CLA. |
|
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
|
This also affects diagnostics in Mattermost Mobile. The current SSLHandshakeException branch calls rejectInvalidCertificate, replacing the original exception with a generic java.lang.Exception/EUNSPECIFIED. Consequently, callers such as getServerUrlAfterRedirect cannot log the underlying TLS failure. Allowing the exception to reach promise.reject(e), as this PR does, preserves the actionable error and avoids the misleading certificate classification. |
Summary
javax.net.ssl.SSLHandshakeExceptioncan be thrown for a variety of reasons unrelated to the certificate being invalid - most notably socket errors while trying to negotiate the TLS session. This can result in spurious warnings about the remote host serving an invalid certificate when a connection is closed remotely, and can easily be triggered by a network change.Given the certificate is validated elsewhere we can trust that users will be warned appropriately so removing this unnecessary warning path is the cleanest fix - handling all relevant sub-errors would be very ugly.