update request log
This commit is contained in:
@@ -29,6 +29,12 @@ class CleanRequestLogsCommand extends HyperfCommand
|
||||
public function handle(): void
|
||||
{
|
||||
$days = (int) $this->input->getOption('days');
|
||||
|
||||
if ($days < 1) {
|
||||
$this->error('保留天数必须大于 0');
|
||||
return;
|
||||
}
|
||||
|
||||
$cutoff = Carbon::now()->subDays($days);
|
||||
|
||||
$deleted = ApiRequestLog::query()
|
||||
|
||||
@@ -86,7 +86,10 @@ class RequestLogMiddleware implements MiddlewareInterface
|
||||
*/
|
||||
public static function sanitizeBody(array $body): array
|
||||
{
|
||||
$sensitive_keys = ['password', 'old_password', 'new_password', 'password_confirmation'];
|
||||
$sensitive_keys = [
|
||||
'password', 'old_password', 'new_password', 'password_confirmation',
|
||||
'token', 'secret', 'api_key', 'access_token', 'refresh_token',
|
||||
];
|
||||
|
||||
foreach ($body as $key => $value) {
|
||||
if (in_array($key, $sensitive_keys, true)) {
|
||||
|
||||
Reference in New Issue
Block a user