I have an HTML select tag in my JSP
<%@ taglib prefix="esapi" uri="http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API"%>
<select>
...
<option value="volvo">${device.name}</option>
....
</select>
I set this as the device name in the db
"><script>alert(1)</script>2d65
I tried to get rid of the warning when loading the page with
<esapi:encodeForHTMLAttribute>${device.name}</esapi:encodeForHTMLAttribute>
or
<esapi:encodeForHTML>${device.name}</esapi:encodeForHTML>
or
<c : out value="${device.name}"/>
or
<esapi:encodeForJavaScript>${device.name}</esapi:encodeForJavaScript>
But there is no way! A warning message always appears when the page loads!
In fact, I see that the characters are escaped, but even if a warning appears in the JSP,

source
share