Sha256: a2231a469cd9a271d60bbb1e2ae1fbc2af4fb81a360ea67e47afcf86166a646c

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require_relative '../../../common/banned_constants'

module Gitlab
  module Styles
    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::SHA2',
              '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(config, options)
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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