how to fix XSS Reflected in java -


i got fortify report shows xss reflected defect below 2nd line.

string name = request.getparameter("name");

response.getwriter().write("name: " + name);

recommendation given: user input displayed web clients should html encoded , validated. java code , not sure how fix this.

a simple way, can use owasp enterprise security api (java edition) :

 string safe = esapi.encoder().encodeforhtml( request.getparameter( "input" ) ); 

see link:

owasp enterprise security api (java edition) documentation

owasp enterprise security api (java edition) code example


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -