【发布时间】:2018-07-12 19:56:26
【问题描述】:
升级到 spring security 4.2.4 后,我发现 StrictHttpFirewall 现在是默认设置。 不幸的是,它不能很好地与 spring MVC @MatrixVariable 一起使用,因为“;”不再被允许。 如何解决这个问题?
例子:
@GetMapping(path = "/{param}")
public void example(@PathVariable String param,
@MatrixVariable Map<String, String> matrix) {
//...
}
这可以这样调用:
mockMvc.perform(get("/someparam;key=value"))
矩阵图将被填充。 现在 spring security 阻止了它。
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:140)
我可以使用允许分号的自定义 HttpFirewall。 有没有办法在不使用禁止字符的情况下使用@MatrixVariable?
顺便说一句:javadoc 不正确https://docs.spring.io/autorepo/docs/spring-security/4.2.x/apidocs/index.html?org/springframework/security/web/firewall/StrictHttpFirewall.html
自:
5.0.1
我猜它是向后移植的?
【问题讨论】:
-
这里是如何允许分号:
标签: spring-mvc spring-security