bugsnag / bugsnag-php

BugSnag error monitoring and crash reporting tool for PHP apps
https://docs.bugsnag.com/platforms/php
MIT License
554 stars 77 forks source link

Add new 'redacted keys' config option to replace 'filters' #623

Closed imjoehaines closed 3 years ago

imjoehaines commented 3 years ago

Goal

This PR adds a 'redacted keys' option, to replace the existing 'filters' option. Filters is problematic because it works with a case-insensitive string contains, which can easily cause false positives

Redacted keys has different semantics but can still express everything that filters could (and more!). Redacted keys can contain both strings and regexes, where string comparisons are case-insensitive and exact — i.e. a matches a and A but not ab. Regexes can be used to emulate filters, e.g. /a/i will match a, A and ab

Redacted keys also attempts to match multi-byte strings by normalising strings and using multi-byte comparisons. This relies on the intl and mbstring extensions, so we fallback to strcasecmp if they are missing (we also try strcasecmp first as it's quicker than normalising + MB comparisons)

Changeset