Filtering sensitive data
You have complete control over what data is sent to Honeybadger. You can filter request data as well as inspect and filter all other data before it’s sent to Honeybadger.
Filtering request data
Section titled “Filtering request data”Honeybadger automatically filters sensitive keys in params, cookies, and
environment data. By default, we filter keys containing password or
creditcard. When you add a property name to the
filters config array,
the values will be removed from error reports before they are sent to our
servers:
{ "submit": "Sign Up", "password": "[FILTERED]"}Here’s an example of configuring additional filters (ssn in this case):
Honeybadger.configure({ filters: ["password", "creditcard", "ssn"],});With the above config, all keys containing ssn, password, or creditcard
will be filtered from request data. Filters are case insensitive; creditcard
and creditCard will both match. Filters are not applied to data sent to
Honeybadger via
the context feature.
Filtering other data
Section titled “Filtering other data”Honeybadger also allows you to inspect and filter all data that is sent to our
servers at the time of an error using a Honeybadger.beforeNotify handler.
For example, to filter the URL of the current page when it contains a sensative param name:
Honeybadger.beforeNotify(function (notice) { if (/creditCard/.test(notice.url)) { notice.url = "[FILTERED]"; }});To filter keys in the context object:
Honeybadger.beforeNotify(function (notice) { Object.keys(notice.context).forEach(function (key) { if (/creditCard/.test(key)) { notice.context[key] = "[FILTERED]"; } });});The following notice properties are available in notice objects:
notice.stack- The stack trace (read only)notice.backtrace- The parsed backtrace objectnotice.name- The exception class namenotice.message- The error messagenotice.url- The current urlnotice.projectRoot- The root urlnotice.environment- Name of the environment. example: “production”notice.component- Similar to a rails controller name. example: “users”notice.action- Similar to a rails action name. example: “create”notice.fingerprint- A unique fingerprint, used to customize grouping of errors in Honeybadgernotice.context- The context objectnotice.tags- A string comma-separated list of tagsnotice.params- An object of request parametersnotice.session- An object of request session key/valuesnotice.headers- An object of request headersnotice.cookies- An object of cookie key/values. May also be sent as a string in the document.cookie “foo=bar;bar=baz” format.
The following additional notice properties are available in afterNotify
handlers:
notice.id- The UUID of the error in Honeybadger