Class: Airbrake::Filters::KeysBlacklist

Inherits:
Object
  • Object
show all
Includes:
KeysFilter
Defined in:
lib/airbrake-ruby/filters/keys_blacklist.rb

Overview

A default Airbrake notice filter. Filters only specific keys listed in the list of parameters in the modifiable payload of a notice.

Examples:

filter = Airbrake::Filters::KeysBlacklist.new(:email, /credit/i, 'password')
airbrake.add_filter(filter)
airbrake.notify(StandardError.new('App crashed!'), {
  user: 'John'
  password: 's3kr3t',
  email: '[email protected]',
  credit_card: '5555555555554444'
})

# The dashboard will display this parameter as is, but all other
# values will be filtered:
#   { user: 'John',
#     password: '[Filtered]',
#     email: '[Filtered]',
#     credit_card: '[Filtered]' }

See Also:

Instance Method Summary collapse

Methods included from KeysFilter

#call, #initialize

Instance Method Details

#should_filter?(key) ⇒ Boolean

Returns true if the key matches at least one pattern, false otherwise.

Returns:

  • (Boolean)

    true if the key matches at least one pattern, false otherwise



32
33
34
# File 'lib/airbrake-ruby/filters/keys_blacklist.rb', line 32

def should_filter?(key)
  @patterns.any? { |pattern| key.to_s.match(pattern) }
end