Sha256: 0cf41e6a822b2224cbaba335475e2acef86f3126671173b53ced484f6b88e896

Contents?: true

Size: 929 Bytes

Versions: 2

Compression:

Stored size: 929 Bytes

Contents

# frozen_string_literal: true

require_relative '../../../gitlab/styles/common/banned_constants'

module Rubocop
  module Cop
    module Fips
      class OpenSSL < RuboCop::Cop::Base
        extend RuboCop::Cop::AutoCorrector
        include Gitlab::Styles::Common::BannedConstants

        MESSAGE_TEMPLATE = 'Usage of this class is not FIPS-compliant. Use %{replacement} instead.'

        REPLACEMENTS = {
          'Digest::SHA1' => 'OpenSSL::Digest::SHA1',
          'Digest::SHA2' => 'OpenSSL::Digest::SHA256',
          'Digest::SHA256' => 'OpenSSL::Digest::SHA256',
          'Digest::SHA384' => 'OpenSSL::Digest::SHA384',
          'Digest::SHA512' => 'OpenSSL::Digest::SHA512'
        }.freeze

        def initialize(config = nil, options = nil)
          @message_template = MESSAGE_TEMPLATE
          @replacements = REPLACEMENTS
          @autocorrect = true
          super
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gitlab-styles-13.0.1 lib/rubocop/cop/fips/open_ssl.rb
gitlab-styles-13.0.0 lib/rubocop/cop/fips/open_ssl.rb