Skip to content
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

OpenSSL usage deprecation warnings from Rubocop #9876

Closed
tas50 opened this issue May 15, 2020 · 2 comments
Closed

OpenSSL usage deprecation warnings from Rubocop #9876

tas50 opened this issue May 15, 2020 · 2 comments

Comments

@tas50
Copy link
Contributor

tas50 commented May 15, 2020

Rubocop has a new cop that detects an upcoming deprecation to the OpenSSL gem that's built into Ruby.

The openssl introducing the deprecation:
ruby/openssl#366

The new rubocop rule currently only in master:
rubocop/rubocop#7950

/Users/tsmith/dev/work/chef/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb:72:13: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.hexdigest('MD5', value) instead of OpenSSL::Digest::MD5.hexdigest(value).
            OpenSSL::Digest::MD5.hexdigest(value)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/digester.rb:42:27: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('SHA256') instead of OpenSSL::Digest::SHA256.new.
        checksum_io(file, OpenSSL::Digest::SHA256.new)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/digester.rb:44:29: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('SHA256') instead of OpenSSL::Digest::SHA256.new.
        checksum_file(file, OpenSSL::Digest::SHA256.new)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/digester.rb:53:27: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('MD5') instead of OpenSSL::Digest::MD5.new.
      checksum_file(file, OpenSSL::Digest::MD5.new)
                          ^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/digester.rb:57:23: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('MD5') instead of OpenSSL::Digest::MD5.new.
      checksum_io(io, OpenSSL::Digest::MD5.new)
                      ^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/encrypted_data_bag_item/decryptor.rb:161:21: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.digest('SHA256', key) instead of OpenSSL::Digest::SHA256.digest(key).
            d.key = OpenSSL::Digest::SHA256.digest(key)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/encrypted_data_bag_item/encryptor.rb:105:27: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.digest('SHA256', key) instead of OpenSSL::Digest::SHA256.digest(key).
          encryptor.key = OpenSSL::Digest::SHA256.digest(key)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/key.rb:255:9: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.hexdigest('SHA1', data_string.to_der) instead of OpenSSL::Digest::SHA1.hexdigest(data_string.to_der).
        OpenSSL::Digest::SHA1.hexdigest(data_string.to_der).scan(/../).join(":")
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/mixin/openssl_helper.rb:221:27: W: Lint/DeprecatedOpenSSLConstant: Use ::OpenSSL::Digest.new('SHA256') instead of ::OpenSSL::Digest::SHA256.new.
        request.sign(key, ::OpenSSL::Digest::SHA256.new)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/mixin/openssl_helper.rb:292:24: W: Lint/DeprecatedOpenSSLConstant: Use ::OpenSSL::Digest.new('SHA256') instead of ::OpenSSL::Digest::SHA256.new.
        cert.sign(key, ::OpenSSL::Digest::SHA256.new)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/mixin/openssl_helper.rb:322:34: W: Lint/DeprecatedOpenSSLConstant: Use ::OpenSSL::Digest.new('SHA256') instead of ::OpenSSL::Digest::SHA256.new.
        crl.sign(ca_private_key, ::OpenSSL::Digest::SHA256.new)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/mixin/openssl_helper.rb:401:34: W: Lint/DeprecatedOpenSSLConstant: Use ::OpenSSL::Digest.new('SHA256') instead of ::OpenSSL::Digest::SHA256.new.
        crl.sign(ca_private_key, ::OpenSSL::Digest::SHA256.new)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/provider/user/dscl.rb:385:15: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('SHA512') instead of OpenSSL::Digest::SHA512.new.
              OpenSSL::Digest::SHA512.new
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/provider/user/dscl.rb:630:13: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('SHA512') instead of OpenSSL::Digest::SHA512.new.
            OpenSSL::Digest::SHA512.new
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/provider/user/mac.rb:494:13: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('SHA512') instead of OpenSSL::Digest::SHA512.new.
            OpenSSL::Digest::SHA512.new
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/provider/user/mac.rb:520:17: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('SHA512') instead of OpenSSL::Digest::SHA512.new.
                OpenSSL::Digest::SHA512.new
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/lib/chef/resource/windows_certificate.rb:311:26: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('SHA1', cert_obj.to_der) instead of OpenSSL::Digest::SHA1.new(cert_obj.to_der).
            thumbprint = OpenSSL::Digest::SHA1.new(cert_obj.to_der).to_s # Fetch its thumbprint
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/spec/support/chef_helpers.rb:30:3: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.hexdigest('SHA256', File.read(path)) instead of OpenSSL::Digest::SHA256.hexdigest(File.read(path)).
  OpenSSL::Digest::SHA256.hexdigest(File.read(path))
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/spec/unit/mixin/openssl_helper_spec.rb:491:30: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('SHA256') instead of OpenSSL::Digest::SHA256.new.
      @ca_cert.sign(@ca_key, OpenSSL::Digest::SHA256.new)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/spec/unit/mixin/openssl_helper_spec.rb:617:30: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('SHA256') instead of OpenSSL::Digest::SHA256.new.
      @ca_cert.sign(@ca_key, OpenSSL::Digest::SHA256.new)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/spec/unit/mixin/openssl_helper_spec.rb:687:30: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('SHA256') instead of OpenSSL::Digest::SHA256.new.
      @ca_cert.sign(@ca_key, OpenSSL::Digest::SHA256.new)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef/spec/unit/mixin/openssl_helper_spec.rb:768:30: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('SHA256') instead of OpenSSL::Digest::SHA256.new.
      @ca_cert.sign(@ca_key, OpenSSL::Digest::SHA256.new)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@tas50 tas50 added the Status: Untriaged An issue that has yet to be triaged. label May 15, 2020
@tas50
Copy link
Contributor Author

tas50 commented May 22, 2020

Resolved with the 0.84 + bugfix release

@tas50 tas50 closed this as completed May 22, 2020
@lock
Copy link

lock bot commented Jun 24, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
@lamont-granquist lamont-granquist removed the Status: Untriaged An issue that has yet to be triaged. label Jun 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants