chef / chef/chef-server

OpenSSL usage deprecation warnings from Rubocop

Open
#1,994 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: oc-id Status: Sustaining Backlog Status: To be prioritized Triage: Confirmed
Dominant language
Erlang
Stars
303
Forks
211
Avg merge
1d 8h
Merged PRs (30d)
5

Description

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

The openssl introducing the deprecation:
https://github.com/ruby/openssl/pull/366

The new rubocop rule currently only in master:
https://github.com/rubocop-hq/rubocop/pull/7950

/Users/tsmith/dev/work/chef-server/src/oc-id/app/models/signature.rb:17:5: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.hexdigest('SHA1', canonical_string) instead of OpenSSL::Digest::SHA1.hexdigest(canonical_string).
    OpenSSL::Digest::SHA1.hexdigest(canonical_string)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef-server/src/oc_erchef/apps/oc_chef_wm/test/password_gen.rb:13:9: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.hexdigest('SHA1', "--#{salt}--#{password}--") instead of OpenSSL::Digest::SHA1.hexdigest("--#{salt}--#{password}--").
        OpenSSL::Digest::SHA1.hexdigest("--#{salt}--#{password}--")
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/tsmith/dev/work/chef-server/src/oc_erchef/apps/oc_chef_wm/test/password_gen.rb:15:9: W: Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Digest.hexdigest('SHA1', "#{salt}--#{password}--") instead of OpenSSL::Digest::SHA1.hexdigest("#{salt}--#{password}--").
        OpenSSL::Digest::SHA1.hexdigest("#{salt}--#{password}--")
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Aha! Link: https://chef.aha.io/features/SH-3048

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review src/oc-id/app/models/signature.rb and src/oc_erchef/apps/oc_chef_wm/test/password_gen.rb, starting with the OpenSSL calls shown in the warning. Update the deprecated usage to the replacement form described by Rubocop, then run Rubocop to confirm that Lint/DeprecatedOpenSSLConstant no longer reports these locations.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cryptography
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.