From a570e49a6ebac990b8319fd7f56d18e8fbb85e22 Mon Sep 17 00:00:00 2001 From: MB Date: Thu, 3 Mar 2022 08:46:06 -0800 Subject: [PATCH] Update LTI_Message_Launch.php fix for https://github.com/IMSGlobal/lti-1-3-php-library/issues/68 --- src/lti/LTI_Message_Launch.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lti/LTI_Message_Launch.php b/src/lti/LTI_Message_Launch.php index 7a18195d..9b9e3235 100644 --- a/src/lti/LTI_Message_Launch.php +++ b/src/lti/LTI_Message_Launch.php @@ -238,8 +238,8 @@ private function cache_launch_data() { private function validate_state() { // Check State for OIDC. - if ($this->cookie->get_cookie('lti1p3_' . $this->request['state']) !== $this->request['state']) { - // Error if state doesn't match + if (!isset($this->request['state']) || $this->cookie->get_cookie('lti1p3_' . $this->request['state']) !== $this->request['state']) { + // Error if state is not set, or doesn't match throw new LTI_Exception("State not found", 1); } return $this; @@ -369,4 +369,4 @@ private function validate_message() { } } -?> \ No newline at end of file +?>