Skip to content

Commit

Permalink
Redact inside extra too #9595
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerKiKi committed Oct 18, 2023
1 parent 6db377c commit b978c0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Log/EventCompleter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public function process(array $event): array
}

// Security hide clear text password
unset($event['extra']['password']);
if (isset($event['extra'])) {
$event['extra'] = $this->redactSensitiveData($event['extra']);
}

return $event;
}
Expand Down
5 changes: 5 additions & 0 deletions tests/Log/EventCompleterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ public function testProcess(): void
'message' => '',
'extra' => [
'errno' => 1,
'password' => 'sensitive',
],
]);

self::assertStringContainsString('Stacktrace:', $actual['message']);
self::assertSame([
'errno' => 1,
'password' => '***REDACTED***',
], $actual['extra']);
self::assertSame(123, $actual['creator_id']);
self::assertSame('my login', $actual['login']);
self::assertIsString($actual['url']);
Expand Down

0 comments on commit b978c0f

Please sign in to comment.