Skip to content

Commit

Permalink
75 : If ajax is disabled, the javascript token injection don't work
Browse files Browse the repository at this point in the history
  • Loading branch information
mmedjahed committed Jul 27, 2017
1 parent 9e26fc1 commit a7c199a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions csrfguard/src/main/resources/csrfguard.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@
* the token hijacking problem.
*/
if(isValidDomain(document.domain, "%DOMAIN_ORIGIN%")) {
var token_name = '%TOKEN_NAME%';
var token_value = '%TOKEN_VALUE%';
/** optionally include Ajax support **/
if(%INJECT_XHR% == true) {
if(navigator.appName == "Microsoft Internet Explorer") {
Expand All @@ -428,8 +430,8 @@

var token_pair = xhr.responseText;
token_pair = token_pair.split(":");
var token_name = token_pair[0];
var token_value = token_pair[1];
token_name = token_pair[0];
token_value = token_pair[1];

XMLHttpRequest.prototype.onsend = function(data) {
if(isValidUrl(this.url)) {
Expand Down

0 comments on commit a7c199a

Please sign in to comment.