Skip to content

Commit

Permalink
Disable automatic evaluation of responses
Browse files Browse the repository at this point in the history
If a response to a $.ajax() request returns a content type of "application/javascript"
JQuery would previously execute the response body. This is a pretty unexpected
behaviour and can result in a bypass of our Content-Security-Policy as well as
multiple unexpected XSS vectors.
  • Loading branch information
LukasReschke committed Sep 15, 2015
1 parent cd90685 commit f2d63d3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,20 @@ function object(o) {
* Initializes core
*/
function initCore() {
/**
* Disable automatic evaluation of responses for $.ajax() functions (and its
* higher-level alternatives like $.get() and $.post()).
*
* If a response to a $.ajax() request returns a content type of "application/javascript"
* JQuery would previously execute the response body. This is a pretty unexpected
* behaviour and can result in a bypass of our Content-Security-Policy as well as
* multiple unexpected XSS vectors.
*/
$.ajaxSetup({
contents: {
script: false
}
});

/**
* Set users locale to moment.js as soon as possible
Expand Down

0 comments on commit f2d63d3

Please sign in to comment.