-
Notifications
You must be signed in to change notification settings - Fork 32
Net::IMAP#starttls doesn't raise an exception when it fails #394
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
Comments
Oh no! Good catch. |
It looks like it's because the exception occurs in the receiver thread, but But it should raise an exception immediately, outside the receiver thread. I'll have a PR in a few minutes. |
Fixes #394. When `start_tls_session` raises an exception, that's caught in the receiver thread, but not re-raised. Fortunately, `@sock` will now be a permanently broken SSLSocket, so I don't think this can lead to accidentally using an insecure connection. Even so, `#starttls` should disconnect the socket and re-raise the error immediately. Failing test case was provided by @rhenium in #394. Co-authored-by: Kazuki Yamaguchi <[email protected]>
Fixes #394. When `start_tls_session` raises an exception, that's caught in the receiver thread, but not re-raised. Fortunately, `@sock` will now be a permanently broken SSLSocket, so I don't think this can lead to accidentally using an insecure connection. Even so, `#starttls` should disconnect the socket and re-raise the error immediately. Failing test case was provided by @rhenium in #394. Co-authored-by: Kazuki Yamaguchi <[email protected]>
That was my thought, too. Thanks for the fix! |
Fixes #394. When `start_tls_session` raises an exception, that's caught in the receiver thread, but not re-raised. Fortunately, `@sock` will now be a permanently broken SSLSocket, so I don't think this can lead to accidentally using an insecure connection. Even so, `#starttls` should disconnect the socket and re-raise the error immediately. Failing test case was provided by @rhenium in #394. Co-authored-by: Kazuki Yamaguchi <[email protected]>
Fixes #394. When `start_tls_session` raises an exception, that's caught in the receiver thread, but not re-raised. Fortunately, `@sock` will now be a permanently broken SSLSocket, so I don't think this can lead to accidentally using an insecure connection. Even so, `#starttls` should disconnect the socket and re-raise the error immediately. Failing test case was provided by @rhenium in #394. Co-authored-by: Kazuki Yamaguchi <[email protected]>
The
OpenSSL::SSL::SSLError
raised fromOpenSSL::SSL::SSLSocket#connect*
is swallowed somewhere.Here is a reproducer:
Output:
The test case
test_starttls_unknown_ca
missed this becauseassert_raise
catches theOpenSSL::SSL::SSLError
raised from#logout
which is implicitly called withinstarttls_test
. Modifying it like this causes a test failure:The text was updated successfully, but these errors were encountered: