Skip to content

NoHandlerFoundException message should not contain all headers [SPR-12984] #17575

@spring-projects-issues

Description

@spring-projects-issues

Lukas Krecan opened SPR-12984 and commented

If DispetcherServlet throwExceptionIfNoHandlerFound is set to true, NoHandlerFoundException is thrown. Unfortunately its message contains headers and thus cookies, which may be a security risk.

In our scenario we serialize the exception to JSON which is returned to the user. Malicious script (for example injected by XSS) can call nonexisting resource and it will get sensitive cookies in the error message.

We have fixed it by overriding noHandlerFound and by throwing custom exception but I am afraid that other users may get to similar situation.


Affects: 4.1.6

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions