Skip to content

Commit

Permalink
fix(session): Log when crypto session data is lost
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst authored and backportbot-nextcloud[bot] committed Oct 20, 2023
1 parent fe46f23 commit e2a7b12
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/private/Session/CryptoSessionData.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCP\ISession;
use OCP\Security\ICrypto;
use OCP\Session\Exceptions\SessionNotAvailableException;
use function OCP\Log\logger;

/**
* Class CryptoSessionData
Expand Down Expand Up @@ -82,9 +83,14 @@ protected function initializeSession() {
try {
$this->sessionValues = json_decode(
$this->crypto->decrypt($encryptedSessionData, $this->passphrase),
true
true,
512,
JSON_THROW_ON_ERROR,
);
} catch (\Exception $e) {
logger('core')->critical('Could not decrypt or decode encrypted session data', [
'exception' => $e,
]);
$this->sessionValues = [];
$this->regenerateId(true, false);
}
Expand Down

0 comments on commit e2a7b12

Please sign in to comment.