Closed
Description
Let's assume that I have the following configuration:
// config/components/log.php
return [
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
'maskVars' => [
'_SERVER.AUTH_GOOGLE_TOKEN',
'_SERVER.AUTH_FACEBOOK_TOKEN',
'_SERVER.AUTH_TWITTER_TOKEN',
'_SERVER.AUTH_GITHUB_TOKEN',
'_SERVER.AUTH_APPLE_TOKEN',
'_SERVER.AUTH_MICROSOFT_TOKEN',
'_SERVER.AUTH_MICROSOFT_TOKEN',
// ...
'_POST.LoginForm.password',
'_POST.ChangePassword.password',
'_POST.ResetPasswordForm.password',
'_POST.ResetPasswordForm.password_repeat',
// ...
]
]
]
]
And the context information to be logged respectively:
$_SERVER = [
'AUTH_GOOGLE_TOKEN' => '***',
'AUTH_FACEBOOK_TOKEN' => '***',
'AUTH_TWITTER_TOKEN' => '***',
'AUTH_GITHUB_TOKEN' => '***',
'AUTH_APPLE_TOKEN' => '***',
'AUTH_MICROSOFT_TOKEN' => '***',
'AUTH_MICROSOFT_TOKEN' => '***',
]
$_POST = [
'LoginForm' => [
'password' => '***',
],
'ResetPasswordForm' => [
'password' => '***',
'password_repeat' => '***',
]
]
But what if instead of tens (or hundreds) predefined variables we will only have a few entries, e.g.
'maskVars' => [
'_SERVER.*TOKEN',
'_POST.*.password',
]
Is it worth it? Would be convenient, huh?