如何停止Spring Boot为它打印堆栈跟踪;安全错误?

时间:2018-10-12 18:41:50

标签: spring spring-boot spring-security

如何阻止将此异常打印在日志文件catalina.out中?它在日志文件中占用了大量空间。

2018-10-12 02:25:20.394 ERROR 20077 --- [nio-8080-exec-7] o.s.boot.web.support.ErrorPageFilter     : Forwarding to error page from request [/home] due to exception [The request was rejected because the URL contained a potentially malicious String ";"]

org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL contained a potentially malicious String ";"
    at org.springframework.security.web.firewall.StrictHttpFirewall.rejectedBlacklistedUrls(StrictHttpFirewall.java:265) ~[spring-security-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.security.web.firewall.StrictHttpFirewall.getFirewalledRequest(StrictHttpFirewall.java:245) ~[spring-security-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
+50 more lines

我不介意单行错误,但我宁愿在滚动日志时也看不到堆栈跟踪。

它们是由于测试请求引起的,例如

172.31.43.154 - - [12/Oct/2018:07:52:42 +0000] "POST /dologin HTTP/1.1" 302 0 "-" "python-requests/2.18.4" "99.99.99.99"
172.31.43.154 - - [12/Oct/2018:07:52:42 +0000] "GET /home;jsessionid=4B9B7C8FFC2EA0B7A8E0C2E20E0B4D79 HTTP/1.1" 200 27 "-" "python-requests/2.18.4" "99.99.99.99"

我不知道测试人员是手动将cookie添加到URL还是重定向到该路径。它可以在浏览器中使用,并且我已经拥有

server.session.tracking-modes=cookie

0 个答案:

没有答案