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
New config option redactedKeys with getters & setters in Client & Configuration
Existing filters option is now marked as deprecated
Report::shouldFilter also uses redactedKeys to check if keys should be filtered/redacted
A new Utils::stringCaseEquals method has been added. This does a unicode-aware, case-insensitive string match
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
matchesa
andA
but notab
. Regexes can be used to emulate filters, e.g./a/i
will matcha
,A
andab
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 trystrcasecmp
first as it's quicker than normalising + MB comparisons)Changeset
redactedKeys
with getters & setters in Client & Configurationfilters
option is now marked as deprecatedReport::shouldFilter
also usesredactedKeys
to check if keys should be filtered/redactedUtils::stringCaseEquals
method has been added. This does a unicode-aware, case-insensitive string match