-
Notifications
You must be signed in to change notification settings - Fork 21
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
Custom CSRF exception mappers are always processed by Krazo #34
Comments
Hey all, I just debugged that issue and I'm not sure if this is really a bug or a lack of detail regarding custom exception mappers in the specification. As specified, we allow to provide custom exception mappers (covered by the TCK), but nowhere is written how the custom So at Krazo, we assume that everything in the To get both ways to work, I created a new Property for Krazo to enable either this strict (default) evaluation of the
PR for this will be created in a few minutes. |
Hi, thanks a lot for helping with this. I agree that the spec currently doesn't explicitly mention how entities produced by exception mappers are handled. At first, I was actually even surprised the Krazo processes these entities. In Krazo there is the However, I also agree that in real world applications most users will most likely want that such exception mappers trigger the view processing pipeline of Krazo. Therefore, my initial example could be a weird corner case. But I like the idea of making the Krazo's behavior more configurable. |
I‘ve tripped over this kind of behavior with CSRF-Exception too. This is one problem with CXF: there, the CSRF-Exception get‘s thrown, but the controller will still render the original view. The exception mapper will set the response code to 403, but cannot update the entity anymore, so the original view is returned with a 403 (Forbidden) response code.
Maybe this kind of configuration option can help there as well?
… Am 31.07.2019 um 07:03 schrieb Christian Kaltepoth ***@***.***>:
Hi,
thanks a lot for helping with this. I agree that the spec currently doesn't explicitly mention how entities produced by exception mappers are handled. At first, I was actually even surprised the Krazo processes these entities. In Krazo there is the ViewResponseFilter which is bound via the @controller binding annotation and basically transforms the result of the controller method into a Viewable instance which is then processed by a MBW for rendering. The interesting thing here is that the CsrfValidationException is thrown even before the controller method is invoked. However, JAX-RS still considers the @controller annotation of the matched controller method and therefore invokes ViewResponseFilter which eventually triggers the view rendering. AFAIK the JAX-RS spec doesn't explicitly mention this behavior and I would bet that JAX-RS implementations handle this case differently.
However, I also agree that in real world applications most users will most likely want that such exception mappers trigger the view processing pipeline of Krazo. Therefore, my initial example could be a weird corner case.
But I like the idea of making the Krazo's behavior more configurable.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@gtudan Thanks for your comment. This CXF behavior sounds really weird. To be honest, I found a few cases where the CXF interpretation of the JAX-RS spec is a bit "special". Anyway, do we already have an issue for this CXF incompatibility? If not, let's create one. |
We do. It's the long-standing issue over here #27 I started digging around in the code a bit, but kind-of forgot about it some time ago. I'll try to put together a minimal example and ask on the CXF mailing list about it. |
@gtudan Ok, great! Thanks! |
This PR should fix eclipse-ee4j#34 and eclipse-ee4j#91
This PR should fix eclipse-ee4j#34 and eclipse-ee4j#91
This PR should fix eclipse-ee4j#34 and eclipse-ee4j#91
MVC allows to define custom exception mappers for
CsrfValidationExceptions
:However, using this mapper currently fails with:
You can reproduce this issue by modifying the mapper by adding a response entity in this TCK test:
https://github.com/mvc-spec/mvc-tck/tree/master/tests/src/main/java/org/mvcspec/tck/tests/security/csrf/exception
The text was updated successfully, but these errors were encountered: