My security team reported one html tag injection security issue for the below code
function ClosePopUp(objBhID) {
var pageName = window.location.pathname;
var modalPopupBehavior = $find(objBhID);
if (modalPopupBehavior != null && modalPopupBehavior != 'undefined') {
modalPopupBehavior.hide();
}
if (objBhID == 'bhThankMsg' && pageName == '/Projects/Comm.aspx') {
var objPartnerID = '<%=Request.QueryString["partnerid"]%>';
if (objPartnerID != 'undefined' && objPartnerID != null && objPartnerID != '') {
window.location = '/Projects/Comm.aspx?Id=<%=Request.QueryString["ID"]%>&partnerid=<%=Request.QueryString["partnerid"]%>';
}
else {
window.location = '/Projects/Comm.aspx?Id=<%=Request.QueryString["ID"]%>';
}
}
}
My security team reported the below issue
HTML tag injection vulnerabilities were identified on this web application. HTML tag injections are used to aid in Cross-Site Request Forgeries and phishing attacks against third-party web sites, and can often double as Cross-Site Scripting vulnerabilities. Recommendations include implementing secure programming techniques that ensure proper filtration of user-supplied data, and encoding all user supplied data to prevent inserted scripts being sent to end users in a format that can be executed.
My requirement is i don't want to allow any user or hacker to inject unnecessary data, how to achieve this ?