Am trying to use ESAPI for security encoding in a webapp (Jsps) to prevent XSS. I added esapi-2.1.0.jar under WEB-INF/lib and added below lines in JSP for encoding
ESAPI.encoder().encodeForHTML(request.getParameter(""))
But I get an exception as below
org.owasp.esapi.errors.ConfigurationException: ESAPI.properties could not be loaded by any means. Fail.
org.owasp.esapi.reference.DefaultSecurityConfiguration.loadConfiguration(DefaultSecurityConfiguration.java:439)
I understand the problem is missing ESAPI.properties file. Should I download this file as well along with esapi-2.1.0.jar? I could see ESAPI.properties is not in esapi-2.1.0.jar. Should I create my own or can I get a default file as am unsure what should be in it ? Appreciate any help.
The most recent public configuration files are located here:
If you read the comments/code in this file, you'll see how to handle file location.
You will need BOTH esapi.properties and validation.properties in order to properly use the library.
Here's an excerpt from the documentation.