Sha256: d6e79228ce2858e377441cd0014525d7b6c44a9703a5b30c61de7065d45182c4
Contents?: true
Size: 965 Bytes
Versions: 5
Compression:
Stored size: 965 Bytes
Contents
module Hermes class Logger class ParamsFilter SENSITIVE_ATTRIBUTES_KEYWORDS = %w(token password credit_card card_number security_code verification_value private_key signature api_key secret_key publishable_key client_key client_secret secret).freeze STRIPPED_VALUE = "[STRIPPED]".freeze private_constant :SENSITIVE_ATTRIBUTES_KEYWORDS, :STRIPPED_VALUE attr_reader :sensitive_keywords, :stripped_value private :sensitive_keywords, :stripped_value def initialize(sensitive_keywords: SENSITIVE_ATTRIBUTES_KEYWORDS, stripped_value: STRIPPED_VALUE) @sensitive_keywords = sensitive_keywords.map(&:to_s) @stripped_value = stripped_value end def call(attribute, value) if sensitive_keywords.any? { |sensitive_attribute| attribute.to_s.match(sensitive_attribute) } && value.respond_to?(:to_str) value.gsub!(value, stripped_value) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems