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

Filter cookies from events by default #596

Merged
merged 3 commits into from
Sep 4, 2020
Merged

Filter cookies from events by default #596

merged 3 commits into from
Sep 4, 2020

Conversation

imjoehaines
Copy link
Contributor

@imjoehaines imjoehaines commented Sep 4, 2020

Goal

In other notifiers, the cookies header is filtered by default and we don't collect a 'Cookies' tab — this PR brings PHP inline

Cookies can still be recorded by a user by removing it as a filtered value and adding the cookie callback. The filter controls whether it shows in 'Request → Headers' and the callback adds the 'Cookies' tab

$bugsnag = \Bugsnag\Client::make();

$bugsnag->setFilters(['password']);
$bugsnag->registerCallback(
    new \Bugsnag\Callbacks\RequestCookies(
        new \Bugsnag\Request\BasicResolver()
    )
);

Changeset

  • No longer register the RequestCookies callback by default
  • Configuration::$filters now contains cookie, to filter the cookie header
  • Added a test for the default callbacks, which also ensures cookies aren't collected as a separate tab and the cookie header is filtered

@imjoehaines imjoehaines marked this pull request as ready for review September 4, 2020 14:06
@imjoehaines imjoehaines requested a review from kattrali September 4, 2020 14:07
Base automatically changed from case-insensitive-filters to next September 4, 2020 14:07
$_SERVER['REQUEST_URI'] = '/abc/xyz?abc=1&xyz=2';
$_GET['abc'] = '1';
$_GET['xyz'] = '2';
$_COOKIE['tastes'] = 'delicious';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆

@imjoehaines imjoehaines merged commit d33e643 into next Sep 4, 2020
@imjoehaines imjoehaines deleted the filter-cookies branch September 4, 2020 14:45
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