Fix OIDC single sign-out breaking due to SameSite cookie changes in Moodle core - #3385
Open
Lai Wei (weilai-irl) wants to merge 1 commit into
Open
Fix OIDC single sign-out breaking due to SameSite cookie changes in Moodle core#3385Lai Wei (weilai-irl) wants to merge 1 commit into
Lai Wei (weilai-irl) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the OIDC single sign-out implementation to remain functional when the IdP-initiated logout request no longer includes the user’s MoodleSession cookie (e.g., due to Moodle core SameSite cookie changes). It does this by persisting the Moodle session ID at login time, then using it to terminate the correct session during logout, and by adjusting SID cleanup to be based on session existence instead of record age.
Changes:
- Store the active Moodle session ID alongside the IdP
sidmapping at login time. - Update the logout endpoint to terminate sessions directly (instead of relying on
$USER/ cookies). - Add schema/upgrade/test/privacy updates for the new
sessionidfield and revised cleanup behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| auth/oidc/version.php | Bumps plugin version to ship the change (currently uses a decimal version literal). |
| auth/oidc/classes/loginflow/authcode.php | Stores session_id() into the OIDC SID mapping during login. |
| auth/oidc/logout.php | Uses stored sessionid to destroy sessions on IdP-initiated logout. |
| auth/oidc/classes/task/cleanup_oidc_sid.php | Changes cleanup logic to delete mappings when the corresponding Moodle session no longer exists. |
| auth/oidc/tests/task/cleanup_oidc_sid_test.php | Updates unit test to validate cleanup based on session existence. |
| auth/oidc/db/install.xml | Adds sessionid field to auth_oidc_sid table definition. |
| auth/oidc/db/upgrade.php | Adds upgrade step to add the sessionid field on upgrade. |
| auth/oidc/classes/privacy/provider.php | Adds sessionid to privacy metadata. |
| auth/oidc/lang/en/auth_oidc.php | Adds language string for the new privacy metadata field. |
Suppressed comments (1)
auth/oidc/db/upgrade.php:600
- The savepoint version should also be an integer (YYYYMMDDXX) matching $plugin->version; using a float here can confuse Moodle's plugin upgrade tracking.
upgrade_plugin_savepoint(true, 2025040830.06, 'auth', 'oidc');
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Lai Wei (weilai-irl)
force-pushed
the
wip-132848-m500
branch
from
August 11, 2026 10:25
2617720 to
332f1d7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.