-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RequestRejectedHandler does not reliable prevent Internal Server Error #11645
Comments
Related PR: #8644 |
@osiegmar Thank you for the report. Could you please create another ticket in regards to your concerns around the additional notes you provide. This will allow us to split up the work into discrete units and provide fixes faster |
Thanks a lot! I can confirm that PR #11670 solves this issue by ensuring I understand that my other expectation (consistent behaviour for read and unread HTTP headers) is not the currently intended behaviour. I’l probably create a new enhancement issue for that. |
If you still have concerns around what is being rejected, I'd create a ticket for that as well |
Describe the bug
The
RequestRejectedHandler
was added to provide a configurable way of handlingRequestRejectedException
thrown byHttpFirewall
. When using aHttpStatusRequestRejectedHandler
the exception is handled by returning a HTTP status code (400 by default) to the client. Unfortunately this is not reliably the case and I consider this as a bug.To Reproduce
StrictHttpFirewall
withHttpStatusRequestRejectedHandler
X-Test
with a value containing\u0099
Then two things can happen:
X-Test
org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the header value "Test �" is not allowed.
)or
Expected behavior
HttpStatusRequestRejectedHandler
(400 by default).Sample
https://github.com/osiegmar/spring-firewall-bug
Additional notes
\u0099
is considered invalid byStrictHttpFirewall
(via regex pattern[\p{IsAssigned}&&[^\p{IsControl}]]*
) but it seems to be valid according section 3.2 of RFC 7230 (field-vchar = VCHAR / obs-text ; VCHAR = %x21-7E ; obs-text = %x80-FF
)The text was updated successfully, but these errors were encountered: