spring-projects / spring-projects/spring-security
CsrfFilter and LazyCsrfTokenRepository use illegal request attribute name javax.servlet.http.HttpServletResponse
@jzheaux is already working on this.
Since Apr 10, 2023.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Summary
CsrfFilter sets the request attribute "javax.servlet.http.HttpServletResponse", which is later used by LazyCsrfTokenRepository to obtain the current response.
According the the Javadoc of ServletRequest.setAttribute(String, Object) names like "javax.*" are "reserved for use by Oracle Corporation".
The name of the request attribute should be changed.
Actual Behavior
LazyCsrfTokenRepository (and maybe others) rely on the presence of the request attribute "javax.servlet.http.HttpServletResponse". There is no clear indication that the request attribute is set by CsrfFilter. Its name might trick people into thinking that it is set by the servlet container, which it is not.
Expected Behavior
The FQCN of CsrfFilter should be used as a prefix for the request attribute name.
Configuration
N/A
Version
5.1.1
Sample
N/A
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.