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 });}因此,veracode指出我在$(".errorView").html(data); 如何解決此問題上有問題。如果我只是將其轉換為文本,它是否會像html一樣顯示在客戶端上?
ajax響應返回html響應(XSS veracode)
UYOU
2021-04-27 14:16:54