From 075cf4c800063e3cc65c3d41a9c23222e8ebb554 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 11 Jan 2023 23:27:14 +0100 Subject: API avoid logging passwords (#5001) * API avoid logging passwords * Strip passwords and tokens from API logs * Only log failed requests information when in debug mode * Remove debug SHA * Clean also Apache logs * Better comments * Redact also token parameters * shfmt * Simplify whitespace * redacted --- p/api/fever.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'p/api/fever.php') diff --git a/p/api/fever.php b/p/api/fever.php index b7f9b9167..13907f16d 100644 --- a/p/api/fever.php +++ b/p/api/fever.php @@ -18,7 +18,8 @@ FreshRSS_Context::initSystem(); // check if API is enabled globally if (!FreshRSS_Context::$system_conf->api_enabled) { - Minz_Log::warning('Fever API: serviceUnavailable() ' . debugInfo(), API_LOG); + Minz_Log::warning('Fever API: service unavailable!'); + Minz_Log::debug('Fever API: serviceUnavailable() ' . debugInfo(), API_LOG); header('HTTP/1.1 503 Service Unavailable'); header('Content-Type: text/plain; charset=UTF-8'); die('Service Unavailable!'); @@ -45,16 +46,16 @@ function debugInfo() { } } global $ORIGINAL_INPUT; - return print_r( - array( + $log = sensitive_log([ 'date' => date('c'), 'headers' => $ALL_HEADERS, '_SERVER' => $_SERVER, '_GET' => $_GET, '_POST' => $_POST, '_COOKIE' => $_COOKIE, - 'INPUT' => $ORIGINAL_INPUT - ), true); + 'INPUT' => $ORIGINAL_INPUT, + ]); + return print_r($log, true); } //Minz_Log::debug('----------------------------------------------------------------', API_LOG); -- cgit v1.2.3