Skip to content

Commit e2a7b12

Browse files
fix(session): Log when crypto session data is lost
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
1 parent fe46f23 commit e2a7b12

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/private/Session/CryptoSessionData.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use OCP\ISession;
3333
use OCP\Security\ICrypto;
3434
use OCP\Session\Exceptions\SessionNotAvailableException;
35+
use function OCP\Log\logger;
3536

3637
/**
3738
* Class CryptoSessionData
@@ -82,9 +83,14 @@ protected function initializeSession() {
8283
try {
8384
$this->sessionValues = json_decode(
8485
$this->crypto->decrypt($encryptedSessionData, $this->passphrase),
85-
true
86+
true,
87+
512,
88+
JSON_THROW_ON_ERROR,
8689
);
8790
} catch (\Exception $e) {
91+
logger('core')->critical('Could not decrypt or decode encrypted session data', [
92+
'exception' => $e,
93+
]);
8894
$this->sessionValues = [];
8995
$this->regenerateId(true, false);
9096
}

0 commit comments

Comments
 (0)