function viewAcc() {
var errorMsg = "";
var result = true;
$(".errorView").hide();
var accNum = document.getElementById('custAccNum').value;
var accType = document.getElementById('custAccType').value;
$("#overlayPopup").show();
$.ajax({
url : '<attribute:resourceURL/>',
data : {
"custNo" : accNum ,
"custType" : accType
},
success : function(data) {
if (data == 'CUS_ACC') {
window.location = "/cust/account/c";
} else {
$("#overlayPopup").hide();
//display warning
$(".errorView").show();
$(".errorView").html(data); // <--- XSS line
e.preventDefault();
}
},
cache : false,
dataType : 'text',
error : function(error, textStatus, errorThrown) {
alert('error in ajax call: ' + textStatus);
console.log('error in ajax call: ' + textStatus);
window.location = "/cust/account/c/lookup";
},
timeout : ajaxTimeOutMilliSeconds
});
}
So the veracode point out says I have issue on $(".errorView").html(data);
How do I fix this? If I just make it to text will it show on the client as is with the html?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…