private function RavenSanitizeIntegration::processEvent in Raven: Sentry Integration 7.4
1 call to RavenSanitizeIntegration::processEvent()
File
- ./
RavenSanitizeIntegration.php, line 45
Class
- RavenSanitizeIntegration
- Sanitizes sensitive data, such as passwords, before sending to Sentry.
Code
private function processEvent(Event $event, Options $options) : void {
// Scrub the pass field from the request body.
$request = $event
->getRequest();
if (!empty($request['data']['pass'])) {
$request['data']['pass'] = self::STRING_MASK;
}
$event
->setRequest($request);
// Scrub sensitive properties of user object.
foreach ($event
->getExceptions() as $exception) {
foreach ($exception
->getStacktrace()
->getFrames() as $frame) {
$vars = $frame
->getVars();
array_walk_recursive($vars, function (&$value, $key) {
if (($key === 'pass' || $key === 'sid' || $key === 'ssid') && is_string($value) && $value) {
$value = self::STRING_MASK;
}
});
$frame
->setVars($vars);
}
}
}