I've inherited a large code base of 1000+ JSP-files that is full of XSS-vulnerabilities.
The code is full of
<%= request.getParameter("theparam")%>
and
out.println("some stuff before"+request.getParameter("theparam")+"and some other stuff");
and
String myVar = request.getParameter("theparam");
out.println(myVar);
I want to secure all files without having to go through all of them individually.
What is my best approach ?
Do a 'replace all' on "request.getParameter("xx")" to "StringEscapeUtils.escapeHtml(request.getParameter("xx")) on all source files ?
Can i somehow override the function 'request.getParameter' so it defaults to stringescapeutils.escapehtml(request.getParameter("")); ?
thnx