ソースを参照

全部的请求方式进行过滤

yq 4 年 前
コミット
3a65fa3948

+ 6 - 6
src/cn/com/usky/filter/XssFilter.java

@@ -58,12 +58,12 @@ public class XssFilter implements Filter
     private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response)
     {
         String url = request.getServletPath();
-        String method = request.getMethod();
-        // GET DELETE 不过滤
-        if (method == null || method.matches("GET") || method.matches("DELETE"))
-        {
-            return true;
-        }
+//        String method = request.getMethod();
+//        // GET DELETE 不过滤
+//        if (method == null || method.matches("GET") || method.matches("DELETE"))
+//        {
+//            return true;
+//        }
         return StringUtils.matches(url, excludes);
     }
 

+ 2 - 0
src/cn/com/usky/filter/XssHttpServletRequestWrapper.java

@@ -38,7 +38,9 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
             for (int i = 0; i < length; i++)
             {
                 // 防xss攻击和过滤前后空格
+                System.out.println("guolv111111"+values[i]);
                 escapseValues[i] = EscapeUtil.clean(values[i]).trim();
+                System.out.println("guolv111111"+escapseValues[i]);
             }
             return escapseValues;
         }