Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply metadata filters case insensitively #595

Merged
merged 1 commit into from
Sep 4, 2020

Conversation

imjoehaines
Copy link
Contributor

@imjoehaines imjoehaines commented Sep 4, 2020

Goal

In most of our notifiers, string filters are applied case insensitively as usually you'd always want to filter both 'password' and 'Password' — the casing doesn't matter

In the PHP library, filters have always been case sensitive, which caused issues when filtering cookies by default — the getallheaders PHP function (and our own fallback) use an uppercase first letter for header names (Cookie), but Laravel uses lowercase headers (cookie)

We could decide that headers should always be lowercased (or uppercased, or aLtErNaTe case) but this seems like a good excuse to bring PHP more inline with our other libraries

NB: PHP applies filters if a string contains the filter, rather than exactly matching. I think changing that would be considered a breaking change as it could result in us recording data that should have been filtered, whereas this change could only filter more data than before

Changeset

  • Use stripos rather than strpos when checking if filters match
  • Added more tests for filter matching

@imjoehaines imjoehaines marked this pull request as ready for review September 4, 2020 13:29
@imjoehaines imjoehaines requested a review from kattrali September 4, 2020 13:30
@imjoehaines imjoehaines merged commit d1e5f20 into next Sep 4, 2020
@imjoehaines imjoehaines deleted the case-insensitive-filters branch September 4, 2020 14:07
@imjoehaines imjoehaines mentioned this pull request Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants