mirror of
https://github.com/pelican-dev/panel.git
synced 2025-08-03 20:02:23 +02:00
Filters sensitive credential fields from auth:fail logs (#1504)
This commit is contained in:
parent
5531bc0ba1
commit
1113ffe0f7
@ -8,6 +8,10 @@ use Illuminate\Auth\Events\Login;
|
|||||||
|
|
||||||
class AuthenticationListener
|
class AuthenticationListener
|
||||||
{
|
{
|
||||||
|
private const PROTECTED_FIELDS = [
|
||||||
|
'password', 'token', 'secret',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles an authentication event by logging the user and information about
|
* Handles an authentication event by logging the user and information about
|
||||||
* the request.
|
* the request.
|
||||||
@ -22,7 +26,9 @@ class AuthenticationListener
|
|||||||
|
|
||||||
if ($event instanceof Failed) {
|
if ($event instanceof Failed) {
|
||||||
foreach ($event->credentials as $key => $value) {
|
foreach ($event->credentials as $key => $value) {
|
||||||
$activity = $activity->property($key, $value);
|
if (!in_array($key, self::PROTECTED_FIELDS, true)) {
|
||||||
|
$activity = $activity->property($key, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user