I'm try to use ESAPI(https://owasp.org/www-project-enterprise-security-api/)
But I try the test code below:
try {
System.out.println("ESAPI TEST:"+ESAPI.encoder().encodeForHTML("<a href='sdfs'></a> < script > alert(); </ script >"));
} catch (Exception e) {
// TODO: handle exception
System.out.println("ESAPI TEST exp:"+e);
}
the code always show error below:
System property [org.owasp.esapi.opsteam] is not set
Attempting to load ESAPI.properties via file I/O.
Attempting to load ESAPI.properties as resource file via file I/O.
Found in 'org.owasp.esapi.resources' directory: /Users/myname/Documents/james/project/WebWorkspace/WebProject/src/main/resources/ESAPI.properties
System property [org.owasp.esapi.devteam] is not set
Loaded 'ESAPI.properties' properties file
SecurityConfiguration for Validator.ConfigurationFile.MultiValued not found in ESAPI.properties. Using default: false
Attempting to load validation.properties via file I/O.
Attempting to load validation.properties as resource file via file I/O.
Found in 'org.owasp.esapi.resources' directory: /Users/myname/Documents/james/project/WebWorkspace/WebProject/src/main/resources/validation.properties
Loaded 'validation.properties' properties file
ESAPI TEST exp:org.owasp.esapi.errors.ConfigurationException: java.lang.reflect.InvocationTargetException Encoder class (org.owasp.esapi.reference.DefaultEncoder) CTOR threw exception.
I had put the ESAPI.properties and validation.properties in the resources folder.
And I was set the Run configurations in the VM arguments panel:
Dorg.owasp.esapi.resources="/Users/myname/Documents/james/project/WebWorkspace/WebProject/src/main/resources"
have anyone can give me a hand , tell me how can I set the ESAPI?What wrong in my setting?
thank you very much.