aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Log/ExceptionSerializerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Log/ExceptionSerializerTest.php')
-rw-r--r--tests/lib/Log/ExceptionSerializerTest.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/lib/Log/ExceptionSerializerTest.php b/tests/lib/Log/ExceptionSerializerTest.php
index 209214a6832..6637c401ab1 100644
--- a/tests/lib/Log/ExceptionSerializerTest.php
+++ b/tests/lib/Log/ExceptionSerializerTest.php
@@ -52,6 +52,14 @@ class ExceptionSerializerTest extends TestCase {
throw new \Exception('expected custom auth exception');
}
+ private function usingSensitiveParameterAttribute(
+ string $login,
+ #[\SensitiveParameter]
+ string $parole,
+ ): void {
+ throw new \Exception('SensitiveParameter attribute');
+ }
+
/**
* this test ensures that the serializer does not overwrite referenced
* variables. It is crafted after a scenario we experienced: the DAV server
@@ -81,4 +89,15 @@ class ExceptionSerializerTest extends TestCase {
$this->assertFalse(isset($serializedData['Trace'][0]['args'][1]));
}
}
+
+ public function testSensitiveParameterAttribute(): void {
+ try {
+ $this->usingSensitiveParameterAttribute('u57474', 'Secret');
+ } catch (\Exception $e) {
+ $serializedData = $this->serializer->serializeException($e);
+ $this->assertSame('usingSensitiveParameterAttribute', $serializedData['Trace'][0]['function']);
+ $this->assertSame('u57474', $serializedData['Trace'][0]['args'][0]);
+ $this->assertSame('*** sensitive parameters replaced ***', $serializedData['Trace'][0]['args'][1]);
+ }
+ }
}