diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2022-06-16 20:32:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-16 20:32:33 +0200 |
commit | 692943860aeec4ce080d356e18cd702b4d85a956 (patch) | |
tree | 0daeb061c81763164fe1ae6ec7d0a0dcf4e2dd54 /lib | |
parent | 0c14ee6ff5a2d3aa3f77f8cd2bf331590ee62f44 (diff) | |
parent | 8b2b5946e60cc81515c6e3ac7462148d81d7acbc (diff) | |
download | nextcloud-server-692943860aeec4ce080d356e18cd702b4d85a956.tar.gz nextcloud-server-692943860aeec4ce080d356e18cd702b4d85a956.zip |
Merge pull request #32898 from nextcloud/fix/noid/logger-overwrites-vars
Fix logger overwriting vars in some circumstances
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Log/ExceptionSerializer.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/private/Log/ExceptionSerializer.php b/lib/private/Log/ExceptionSerializer.php index dab134b26a4..3c3ff95f8e1 100644 --- a/lib/private/Log/ExceptionSerializer.php +++ b/lib/private/Log/ExceptionSerializer.php @@ -42,6 +42,8 @@ use OCA\Encryption\Session; use OCP\HintException; class ExceptionSerializer { + public const SENSITIVE_VALUE_PLACEHOLDER = '*** sensitive parameters replaced ***'; + public const methodsWithSensitiveParameters = [ // Session/User 'completeLogin', @@ -180,7 +182,7 @@ class ExceptionSerializer { if (isset($traceLine['args'])) { $sensitiveValues = array_merge($sensitiveValues, $traceLine['args']); } - $traceLine['args'] = ['*** sensitive parameters replaced ***']; + $traceLine['args'] = [self::SENSITIVE_VALUE_PLACEHOLDER]; return $traceLine; } @@ -208,14 +210,16 @@ class ExceptionSerializer { } private function removeValuesFromArgs($args, $values) { - foreach ($args as &$arg) { + $workArgs = []; + foreach ($args as $arg) { if (in_array($arg, $values, true)) { - $arg = '*** sensitive parameter replaced ***'; + $arg = self::SENSITIVE_VALUE_PLACEHOLDER; } elseif (is_array($arg)) { $arg = $this->removeValuesFromArgs($arg, $values); } + $workArgs[] = $arg; } - return $args; + return $workArgs; } private function encodeTrace($trace) { |