From ec32978050ecf02783b6a37694317eefe7586778 Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 10 Jan 2025 13:34:40 -0500 Subject: [PATCH] Handle missing session in DHE exchange requests --- src/Socialbox/Socialbox.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Socialbox/Socialbox.php b/src/Socialbox/Socialbox.php index 519b3ba..45064a7 100644 --- a/src/Socialbox/Socialbox.php +++ b/src/Socialbox/Socialbox.php @@ -286,8 +286,14 @@ return; } - // Check if the session is awaiting a DHE exchange, forbidden if not $session = $clientRequest->getSession(); + if($session === null) + { + self::returnError(404, StandardError::SESSION_NOT_FOUND, 'Session not found'); + return; + } + + // Check if the session is awaiting a DHE exchange, forbidden if not if($session->getState() !== SessionState::AWAITING_DHE) { self::returnError(403, StandardError::FORBIDDEN, 'Bad request: The session is not awaiting a DHE exchange');