Getting 403 error when using CSRF filter with tomcat 6.0.32

你离开我真会死。 提交于 2019-12-05 08:50:22
pd40

Note that a 403 is the CSRFPreventionFilter response if a nonce is not provided and the filter expects one.

I don't know the current state of CSRFPreventionFilter, but according to this thread you need to specify each entryPoint resource individually (no wildcards) - or have the filter apply to a path that does not include /login

So:

<filter>
<filter-name>CSRFPreventionFilter</filter-name>
<filter-class>org.apache.catalina.filters.CsrfPreventionFilter</filter-class>
<init-param>
    <param-name>entryPoints</param-name>
    <param-value>/login/login.html,/login/image.png,/login/style.css</param-value>
</init-param>
</filter>

Or:

<filter-mapping>
<filter-name>CSRFPreventionFilter</filter-name>
<url-pattern>/csrf/*</url-pattern>
</filter-mapping>

Update Dec 2012:

Tomcat 7.0.32 fixes a security vulnerability in CSRFPreventionFilter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!