Skip to content

Commit e615178

Browse files
authored
Make SSL hostname verification default to on (#636)
Following up on this comment: #634 (review) The previous logic skipped hostname verification entirely if the `verify_hostname` method is not defined for `OpenSSL::SSL::SSLContext`, which is currently the case for JRuby. This commit changes the logic so if that method is undefined, hostname verification is still performed. Otherwise, hostname verification would always be skipped on Rubies which don't define a `verify_hostname` method. Note that this was *just* introduced in #634 which was merged 10 hours ago, so I think this was caught quickly enough simply correcting it suffices and there isn't additional security-related followup here (e.g. CVE)
1 parent 9bb0136 commit e615178

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/http/timeout/null.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def start_tls(host, ssl_socket_class, ssl_context)
3636
connect_ssl
3737

3838
return unless ssl_context.verify_mode == OpenSSL::SSL::VERIFY_PEER
39-
return unless ssl_context.respond_to?(:verify_hostname) && ssl_context.verify_hostname
39+
return if ssl_context.respond_to?(:verify_hostname) && !ssl_context.verify_hostname
4040

4141
@socket.post_connection_check(host)
4242
end

0 commit comments

Comments
 (0)