Class: RuboCop::Cop::Sidekiq::SensitiveDataInArguments

Inherits:
Base
  • Object
show all
Includes:
ArgumentTraversal
Defined in:
lib/rubocop/cop/sidekiq/sensitive_data_in_arguments.rb

Overview

Checks for sensitive data passed as Sidekiq job arguments.

Examples:

# bad
UserJob.perform_async(user_id, password)

# good
UserJob.perform_async(user_id)

Constant Summary collapse

MSG =
'Avoid passing sensitive data in Sidekiq job arguments.'
DEFAULT_PATTERNS =
%w[
  password passwd pwd token api_key secret credit_card card_number cvv ssn
].freeze
RESTRICT_ON_SEND =
PerformMethods.all

Instance Method Summary collapse

Methods included from Sidekiq::Language

#active_job_class?, #perform_call?, #sidekiq_include?, #sidekiq_options_call?

Instance Method Details

#on_send(node) ⇒ Object Also known as: on_csend



26
27
28
29
30
# File 'lib/rubocop/cop/sidekiq/sensitive_data_in_arguments.rb', line 26

def on_send(node)
  perform_call?(node) do
    check_arguments(node.arguments, allow_literal: true)
  end
end