I am looking to add a some strict cross-scripting rules to my application which is based on Spring. I added the recommended html ‘defaultHtmlEscape’ to true and used the tag, but there are still some things we would like to prevent. I decided to use the java html sanitizer from https://www.owasp.org/index.php/OWASP_Java_HTML_Sanitizer_Project . This will require me to call the sanitizing function every where a parameter is read, which is changes in a lot of places. Is there a central place I can do this? Perhaps, a class through which all the parameters are parsed? I saw that the NamedParameterUtils is used internally in Spring to parse the parameters. Is there a way to extend it?
Is there any other way of doing this in Spring framework?
Any pointers are greatly appreciated.
thanks,
Asha
Hate to answer my own question. You can add a filter class in Spring and have the parameters pass through them. More information is at: http://jeevanpatil.wordpress.com/2011/07/22/prevention_of_xss/ in the ‘Filter Approach’ section.