Skip to content
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

CSRF entity body validation is not possible for multipart/form-data requests #241

Open
pdudits opened this issue Dec 22, 2020 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@pdudits
Copy link

pdudits commented Dec 22, 2020

When CSRF protection engaged on a method annotated

    @POST
    @Produces(MediaType.TEXT_HTML)
    @Controller
    @Consumes(MediaType.MULTIPART_FORM_DATA)

Can only be validated via HTTP header match. I understand that support for this feature is optional per MVC spec, but currently it is impossible to implement it in Krazo via configuration or SPI.

Even though Application or SPI could provide custom handling via FormEntityProvider, the check is done sooner than FormEntityProvider is queried.

I could contribute a solution myself, but I'd need advice on most fitting solution. I currently see these two options:

  1. Let FormEntityProvider decide if it can handle the entity. Application or SPI package can provide handling for multipart requests.
  2. Add configuration property that will skip Csrf validation in this case (so that application can handle it itself in case of implicit protection)
@chkal
Copy link
Contributor

chkal commented Dec 23, 2020

Thanks a lot for reporting this. Maybe a first step would be to get a failing testcase that reproduces this issue? Not sure if you saw the testsuite directory which contains Arquillian based tests which we can run against different containers.

@gtudan IIRC you built the FormEntityProvider SPI back then. Any thoughts?

@erdlet erdlet added this to the 4.0.0 milestone Dec 5, 2022
@erdlet erdlet added the enhancement New feature or request label Dec 5, 2022
@erdlet erdlet modified the milestones: 4.0.0, Future Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants