diff --git a/src/main/java/com/key/common/plugs/xss/XssHttpWrapper.java b/src/main/java/com/key/common/plugs/xss/XssHttpWrapper.java index d98af56..5b24890 100644 --- a/src/main/java/com/key/common/plugs/xss/XssHttpWrapper.java +++ b/src/main/java/com/key/common/plugs/xss/XssHttpWrapper.java @@ -47,6 +47,13 @@ public class XssHttpWrapper extends HttpServletRequestWrapper { */ @Override public String getHeader(String name) { + if("If-None-Match".equals(name)){ +// W/"14873-1619252839000" + String value = super.getHeader(name); + if(value==null || value.length()<50){ + return super.getHeader(name); + } + } String value = super.getHeader(xssEncode(name)); if (value != null) { value = xssEncode(value); @@ -54,8 +61,8 @@ public class XssHttpWrapper extends HttpServletRequestWrapper { return value; } - - + + /** * * @param name @@ -169,6 +176,7 @@ public class XssHttpWrapper extends HttpServletRequestWrapper { */ public String xssEncode(String s) { + if (s == null || s.isEmpty()) { return s; @@ -188,7 +196,6 @@ public class XssHttpWrapper extends HttpServletRequestWrapper { result = escape(result); } } - return result; } @@ -247,4 +254,4 @@ public class XssHttpWrapper extends HttpServletRequestWrapper { } return value; } -} \ No newline at end of file +} diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 619972a..edc1af7 100755 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -47,7 +47,7 @@ - + xssFilter com.key.common.plugs.xss.XssFilter