mirror of
https://github.com/moodle/moodle.git
synced 2025-07-18 21:01:27 +02:00
MDL-50784 ajax: Require a sesskey for all ajax requests.
This needs to be done before we can expose any webservices that change state, or return private info to ajax (to prevent CSRF). Currently there are no webservices exposed to ajax that meet these criteria - so this issue is to prevent future security issues.
This commit is contained in:
committed by
Eloy Lafuente (stronk7)
parent
5fceb11e6c
commit
b0a583932a
@@ -146,13 +146,13 @@ define(['jquery', 'core/config'], function($, config) {
|
||||
|
||||
// Jquery deprecated done and fail with async=false so we need to do this 2 ways.
|
||||
if (async) {
|
||||
$.ajax(config.wwwroot + '/lib/ajax/service.php', settings)
|
||||
$.ajax(config.wwwroot + '/lib/ajax/service.php?sesskey=' + config.sesskey, settings)
|
||||
.done(requestSuccess)
|
||||
.fail(requestFail);
|
||||
} else {
|
||||
settings.success = requestSuccess;
|
||||
settings.error = requestFail;
|
||||
$.ajax(config.wwwroot + '/lib/ajax/service.php', settings);
|
||||
$.ajax(config.wwwroot + '/lib/ajax/service.php?sesskey=' + config.sesskey, settings);
|
||||
}
|
||||
|
||||
return promises;
|
||||
|
Reference in New Issue
Block a user