In my application we are using window.location.href. Code snippet pasted below.
clearSelection : function()
{
$('#clearSelection').on('click', function(){
var url = window.location.href;
if(url.indexOf('/c/') > 0){
var refineUrl = url.substring(0, url.indexOf('?')).concat('?text=defaultPage&display=allMaterials');
}
else if(url.indexOf('/search') > 0){
var refineUrl = url.substring(0, url.indexOf('?')).concat('?text=').concat($('#textSearchValue').val());
}
window.location.href = refineUrl;
});
}
Burp tool is showing this code is vulnerable. So my question is how it is vulnerable and what is good fix for this.
Your answer will be very much appreciated.