From 35e82b9fad4ab0c579c4617da414aba3b59169e1 Mon Sep 17 00:00:00 2001 From: Jake Dallimore Date: Thu, 15 Feb 2024 12:17:29 +0800 Subject: [PATCH] MDL-80835 enrol_lti: add partitioning support for OIDC state cookie Adds the property that is required by Chrome to opt-in to its 3rd party cookie partitioning solution, CHIPS. This specific change ensures the 'state' cookie, used in the OIDC handshake, has partitioning support. This cookie can be partitioned unconditionally, since it's a cookie controlled by the library and one we don't expect to be set without partitioning elsewhere. --- enrol/lti/classes/local/ltiadvantage/lib/lti_cookie.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/enrol/lti/classes/local/ltiadvantage/lib/lti_cookie.php b/enrol/lti/classes/local/ltiadvantage/lib/lti_cookie.php index 1a6b11fe552..585fdad2523 100644 --- a/enrol/lti/classes/local/ltiadvantage/lib/lti_cookie.php +++ b/enrol/lti/classes/local/ltiadvantage/lib/lti_cookie.php @@ -16,6 +16,7 @@ namespace enrol_lti\local\ltiadvantage\lib; +use auth_lti\local\ltiadvantage\utility\cookie_helper; use Packback\Lti1p3\Interfaces\ICookie; /** @@ -55,6 +56,9 @@ class lti_cookie implements ICookie { setcookie($name, $value, array_merge($cookieoptions, $samesiteoptions, $options)); + // Necessary, since partitioned can't be set via setcookie yet. + cookie_helper::add_attributes_to_cookie_response_header($name, ['Partitioned']); + // Set a second fallback cookie in the event that "SameSite" is not supported. setcookie('LEGACY_'.$name, $value, array_merge($cookieoptions, $options)); }