I have written a Filter
Below is the code.
public void doFilter(ServletRequest request, ServletResponse response,FilterChain chain)
throws IOException, ServletException {
HttpServletRequest srequest = (HttpServletRequest) request;
HttpServletResponse sresponse = (HttpServletResponse) response;
String url = srequest.getRequestURI();
if(url.contains("//What patterns to be checked here?"))
{
//Invalidate the Session
//Redirect to error page
}
Am reading the URL formed and want to avoid XSS
attacks. So, I want to check in the URL for any patterns which might indicate that it could lead to XSS
attack.
Can I get a consolidated list of all patterns that I can check here? For eg.,
url.contains("<script>");