Fix OIDC account-linking failing under SameSite=Lax - #3358
Open
Lai Wei (weilai-irl) wants to merge 1 commit into
Open
Fix OIDC account-linking failing under SameSite=Lax#3358Lai 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.
🔵 Human review recommended
It changes authentication/session restoration behavior (including programmatic login) and should receive a final human security-focused review before approval.
Pull request overview
This PR addresses OIDC account-linking flows where the callback can arrive as a cross-site POST (response_mode=form_post) and a SameSite=Lax Moodle session cookie may not be sent, causing the linking flow to lose the initiating user session.
Changes:
- Persist the initiating Moodle user id into the OIDC state record when the auth request is initiated from a logged-in (non-guest) user.
- On callback, recover the initiating user from the state record (falling back to the live session for older state records) and restore the session to that user before proceeding with account linking/migration.
File summaries
| File | Description |
|---|---|
| auth/oidc/classes/loginflow/authcode.php | Stores the initiating user id in OIDC state and restores the initiating user session during callback handling to survive SameSite=Lax form_post callbacks. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
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.