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 #5031

Closed
tas50 opened this issue May 15, 2020 · 1 comment · Fixed by #5035
Closed

OpenSSL usage deprecation warnings from Rubocop #5031

tas50 opened this issue May 15, 2020 · 1 comment · Fixed by #5035

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/inspec/lib/inspec/fetcher/git.rb:102:7: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.hexdigest('SHA256', resolved_ref + @relative_path) instead of OpenSSL::Digest::SHA256.hexdigest(resolved_ref + @relative_path).
      OpenSSL::Digest::SHA256.hexdigest(resolved_ref + @relative_path)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/inspec/lib/inspec/fetcher/local.rb:107:25: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.digest('SHA256', File.read(target)) instead of OpenSSL::Digest::SHA256.digest(File.read(target)).
      @archive_shasum = OpenSSL::Digest::SHA256.digest(File.read(target)).unpack("H*")[0]
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/inspec/lib/inspec/fetcher/url.rb:130:27: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.digest('SHA256', File.read(@archive_path || temp_archive_path)) instead of OpenSSL::Digest::SHA256.digest(File.read(@archive_path || temp_archive_path)).
      @archive_shasum ||= OpenSSL::Digest::SHA256.digest(File.read(@archive_path || temp_archive_path)).unpack("H*")[0]
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/inspec/lib/inspec/profile.rb:562:13: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.new('SHA256') instead of OpenSSL::Digest::SHA256.new.
      res = OpenSSL::Digest::SHA256.new
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Schwad pushed a commit that referenced this issue May 18, 2020
Fixes #5031

See above issue for full context, this updates to the latest rubocop requirements for incoming ruby OpenSSL deprecations

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
@Schwad
Copy link
Contributor

Schwad commented May 18, 2020

@tas50 running pipeline on these changes in #5035 to see if we run green. Thanks for providing the examples and background! 🙏

Schwad pushed a commit that referenced this issue May 19, 2020
Fixes #5031

See above issue for full context, this updates to the latest rubocop requirements for incoming ruby OpenSSL deprecations

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants