Skip to content

Commit

Permalink
Refs #2701
Browse files Browse the repository at this point in the history
prevent click jacking attacks by dynamically adding the token auth when the link is clicked

git-svn-id: http://dev.piwik.org/svn/trunk@5804 59fd770c-687e-43c8-a1e3-f5a4ff64c105
  • Loading branch information
mattab committed Feb 11, 2012
1 parent b010d7c commit 7f07937
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions plugins/CoreHome/templates/datatable.js
Expand Up @@ -545,7 +545,14 @@ dataTable.prototype =
});


$('.exportToFormatItems a', domElem).attr( 'href', function(){
$('.exportToFormatItems a', domElem)
// prevent click jacking attacks by dynamically adding the token auth when the link is clicked
.click( function() {
$(this).attr('href', function() {
return $(this).attr('href') +'&token_auth='+piwik.token_auth;
})
})
.attr( 'href', function(){
var format = $(this).attr('format');
var method = $(this).attr('methodToCall');
var filter_limit = $(this).attr('filter_limit');
Expand All @@ -570,7 +577,6 @@ dataTable.prototype =
+'&idSite='+self.param.idSite
+'&period='+period
+'&date='+param_date
+'&token_auth='+piwik.token_auth
+ ( typeof self.param.filter_pattern != "undefined" ? '&filter_pattern=' + self.param.filter_pattern : '')
+ ( typeof self.param.filter_pattern_recursive != "undefined" ? '&filter_pattern_recursive=' + self.param.filter_pattern_recursive : '')
+'&expanded=1';
Expand All @@ -596,7 +602,6 @@ dataTable.prototype =
{
str += '&label='+encodeURIComponent(label);
}
console.log(str);
return str;
}
);
Expand Down

0 comments on commit 7f07937

Please sign in to comment.