
PKumar022351 (Community Member) asked a question.
Below is My Existing Code:
String strOut = "<td width=\"10%\" id=\"searchResultsHeaderTDProd\" bgcolor=\"" + bgColor + "\"><font id=\"searchResultsInfoAdd\"><b>" + ESAPI.encoder().encodeForHTML(policyNumber)+"</b></font>";
strOut+="<br><font id=\"searchResultsInfoAdd\"><b>"+ESAPI.encoder().encodeForHTML(policyStatus)+"</b></font></td>";
out.println(strOut); -- Here this line getting Improper Neutralization of Script-Related HTML Tags
I am using below code to Resolve :
out.println(ESAPI.encoder().canonicalize(strOut));
But after scan still report is showing CWE 80 flaws and its not gone. Please assist me to resolve this issue.
.png)
Hi @PKumar022351 (Community Member),
I appreciate this reply is very late but if this is still an issue for you then please note that the canonicalize() function of the ESAPI encoder (https://github.com/ESAPI/esapi-java-legacy/blob/d7bb3a537a76954242db94a6dd2cdb4a88a2856c/src/main/java/org/owasp/esapi/Encoder.java#L70) does not cleanse against CWE-80. The recommendation is to use an approved cleanser from the ESAPI library as documented in the Help Centre: https://help.veracode.com/reader/4EKhlLSMHm5jC8P8j3XccQ/IiF_rOE79ANbwnZwreSPGA.
Thanks,
Anthony Fielding