Fix missing sesskey validation on state-changing admin endpoints - #3371
Open
Patryk Mroczko (patmr7) wants to merge 1 commit into
Open
Fix missing sesskey validation on state-changing admin endpoints#3371Patryk Mroczko (patmr7) wants to merge 1 commit into
Patryk Mroczko (patmr7) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR strengthens CSRF protections in the Microsoft 365 Moodle integration by enforcing sesskey validation on several state-changing admin endpoints and ensuring the initiating URLs include a sesskey where needed.
Changes:
- Added
require_sesskey()checks to multiple state-changing actions (e.g., cohort sync deletion, user match queue clearing, Teams connection operations, maintenance cleanup, and user connection actions). - Updated admin/action URLs to include
sesskey => sesskey()so the new sesskey requirements can be satisfied when actions are triggered via links/AJAX.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| local/o365/cohortsync.php | Requires sesskey for the delete action that removes cohort sync mappings. |
| local/o365/classes/page/acp.php | Enforces sesskey checks on multiple ACP state-changing modes and adds sesskey to several action URLs. |
| local/o365/classes/form/cohortsync.php | Adds sesskey to the “delete mapping” URL used by the cohort sync UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Patryk Mroczko (patmr7)
force-pushed
the
wip-133982-m502
branch
from
August 7, 2026 13:36
a38ce48 to
64df0aa
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
local/o365/classes/page/acp.php:1961
mode_maintenance_cleandeltatoken()now enforcesrequire_sesskey(), but the navbar link built later in this method uses['mode' => 'cleandeltatoken'](missing themaintenance_prefix) and does not includesesskey. Clicking that breadcrumb will route to the wrong mode and/or fail sesskey validation.
require_sesskey();
|
|
||
| // Clear delta token. | ||
| $toolurl = new url($this->url, ['mode' => 'maintenance_cleandeltatoken']); | ||
| $toolurl = new url($this->url, ['mode' => 'maintenance_cleandeltatoken', 'sesskey' => sesskey()]); |
Patryk Mroczko (patmr7)
force-pushed
the
wip-133982-m502
branch
from
August 7, 2026 13:51
64df0aa to
9567172
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.