[ruby-core:117717] [Ruby master Bug#20458] OpensSSL::SSL::SSLContext#min_version= and #max_version no longer accept Symbol values
From:
"postmodern (Hal Brodigan) via ruby-core" <ruby-core@...>
Date:
2024-04-25 21:58:11 UTC
List:
ruby-core #117717
Issue #20458 has been updated by postmodern (Hal Brodigan).
Also I just now noticed that `SSLContext#ssl_version=` is deprecated. This issue can be closed.
----------------------------------------
Bug #20458: OpensSSL::SSL::SSLContext#min_version= and #max_version no longer accept Symbol values
https://bugs.ruby-lang.org/issues/20458#change-108124
* Author: postmodern (Hal Brodigan)
* Status: Open
* ruby -v: ruby 3.3.1 (2024-04-23 revision c56cd86388) [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
It appears that `OpenSSL::SSL::SSLContext#min_version=` and `#max_version=` no longer accept Symbol values, contrary to their [documentation](https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#method-i-min_version-3D). Instead it appears they are being converted to Strings.
## Steps To Reproduce
```ruby
require 'openssl'
context = OpenSSL::SSL::SSLContext.new
context.min_version = :TLSv1
```
```ruby
require 'openssl'
context = OpenSSL::SSL::SSLContext.new
context.max_version = :TLSv1_2
```
### Expected Results
Sets `min_version` and `max_version` to the according `OpenSSL::SSL::TLS1_VERSION` and `OpenSSL::SSL::TLS1_2_VERSION` values, respectively.
### Actual Results
```
/usr/share/ruby/openssl/ssl.rb:179:in `set_minmax_proto_version': unrecognized version "TLSv1" (ArgumentError)
set_minmax_proto_version(version, @max_proto_version ||= nil)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
from /usr/share/ruby/openssl/ssl.rb:179:in `min_version='
```
```
/usr/share/ruby/openssl/ssl.rb:191:in `set_minmax_proto_version': unrecognized version "TLSv1_2" (ArgumentError)
set_minmax_proto_version(@min_proto_version ||= nil, version)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
from /usr/share/ruby/openssl/ssl.rb:191:in `max_version='
```
### Version Info
Tested on:
* `ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]` and `openssl` gem version `3.1.0`
* `ruby 3.3.1 (2024-04-23 revision c56cd86388) [x86_64-linux]` and `openssl` gem version `3.2.0`
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/