Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Filtering sensitive data

Kyrylo Silin edited this page Aug 24, 2016 · 16 revisions

END OF SUPPORT WARNING: On November 24, 2016 Airbrake v4 won't be supported anymore and this wiki will be deleted. Read more & discuss: https://github.com/airbrake/airbrake/issues/596

DEPRECATION WARNING: The information presented on this page is related to Airbrake v4 only. If you seek for information for Airbrake v5, please refer to our README!

To replace sensitive information sent to the Airbrake service with [FILTERED] use one of these approaches:

Blacklist filters

Data which is defined in blacklist filters will be replaced with [FILTERED]


##### Where will filters be applied?

Once set blacklist filters will filter matching keys in params, sessions and cgi_data.


##### What is in the default list of blacklist filters? `["password", "password_confirmation"]`

These are in the config.params_filters array in your Airbrake initialization file (airbrake.rb).


##### Adding/Modifying the default filter list (In your `airbrake.rb` file)
Use strings, symbols or regular expressions

config.params_filters << [:foo, /bar/, "credit_card"]

Filter "credit_card" and other params from default list

config.params_filters << "credit_card"

Only filter "credit_card" and ignore default list

config.params_filters = ["credit_card"]

Ignore default list and don't filter anything

config.params_filters = []


Whitelist filters

All data which is not defined in whitelist filters will be replaced with [FILTERED]


##### Where will filters be applied?

Once set whitelist filters will be applied to params, sessions and cgi_data.


##### Which are default?

By default, all params are whitelisted []


##### Using whitelist filters

(In your airbrake.rb file)

Filter everything except "username"

config.params_whitelist_filters = ["username"]

Filter everything except "good_to_go"

config.params_whitelist_filters << "good_to_go"

Use strings, symbols or regular expressions

config.params_whitelist_filters << [:foo, /bar/, "visible"]

Note that, when rescuing exceptions within an ActionController method, airbrake will reuse filters specified by #filter_parameter_logging.