【fix sonar】XSSUtils文件

This commit is contained in:
梁琦涛
2023-04-04 10:44:32 +08:00
parent 6db0d0eb7d
commit be5773bd71
@@ -35,9 +35,10 @@ public class XSSUtils {
value = scriptPattern.matcher(value).replaceAll(""); value = scriptPattern.matcher(value).replaceAll("");
scriptPattern = Pattern.compile("onload(.*?)=", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL); scriptPattern = Pattern.compile("onload(.*?)=", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
value = scriptPattern.matcher(value).replaceAll(""); value = scriptPattern.matcher(value).replaceAll("");
}
return HtmlUtils.htmlEscape(value); return HtmlUtils.htmlEscape(value);
} }
return null;
}
public static void main(String[] args) { public static void main(String[] args) {
String s = striptXSS("<img src=x onload=alert(111).*?><script></script>javascript:eval()\\\\."); String s = striptXSS("<img src=x onload=alert(111).*?><script></script>javascript:eval()\\\\.");