-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
RESTEasy Reactive: make body-reading filters force reading the body #22444
Comments
/cc @geoand, @stuartwdouglas |
Thanks for reporting. I'll have a look. |
Under what circumstances would we read the body? For each and every resource method (that is |
Yeah, I guess. If such filters are present. |
Just to be sure we are on the same page, what do you expect to be able to do in a such a filter when there is no body? |
In my case there is a body :) It's just that the endpoint isn't reading it. My filter is verifying CRSF tokens set in the form body, without the endpoint having to worry about them. |
And you expect your filter to read the input stream? |
Oh no. The content-type is formish (urlencoded or multipart) so I expect RR to read it and populate |
Hm... That's a little tough TBH as we engage the form handling code based on the |
Mmmm… I never set that |
Ah, right - absolutely correct. The point is that up until now, we have relied on the declarative way to figure out if we should be reading a form or not. |
Yeah. Not sure what's best to do here. Probably let's think about this some more… |
1 similar comment
Yeah. Not sure what's best to do here. Probably let's think about this some more… |
Yup, I agree |
Note that the new security-crsf extension does this by using the Vert.x request to force-read the body. Also note that another user requested this for regular endpoints: #25103 (reply in thread) |
So, both #25103 (reply in thread) and #29763 rely on forcing reading form parameters. In one case for a filter, in the other, for an endpoint. We could make a I thought about making it more generic even, and do something like @geoand WDYT? |
A generic |
Any opinion on naming?
We could also repurpose |
I like |
Yes, I thought so too :) |
OK, let's see if I can do this. |
💪🏼 |
@FroMage May be worth avoiding |
I'm not sure how we can force the body being read if we don't have any idea what type to deserialise it to by having a declared body parameter. I'd rather wait for a requirement for this feature than make it more complex than it needs now with the two use-cases we do have and know. |
I'm not sure exactly how |
Oh darn, I forgot about that completely... |
Maybe we should deprecate it? |
Well, it seems sublty different, because it forces the filter to be run after the body has been read (by what?) but before deserialisation happens (which is not the case for form parameters, they're deserialised). So, they sort of seem related but orthogonal too :( |
Interesting that |
The other thing that's interesting is that the |
LOL |
Every time I touch this issue, I'm reminded that "it's complicated" 😂 |
Apparently, the Now, the semantics of If there are no It'd be more correct to call it I could make I could also make Or we keep both concerns separate. Apparently, we added |
Thanks for looking into it! I agree, let's deprecate the field and use the new annotation to imply it |
You can also place it on endpoint methods. Fixes quarkusio#22444
You can also place it on endpoint methods. Fixes quarkusio#22444
You can also place it on endpoint methods. Fixes quarkusio#22444
OK, done in #29825 |
You can also place it on endpoint methods. Fixes quarkusio#22444 (cherry picked from commit 04e20f6)
Description
In #22209 I asked to be able to run request filters after the body has been read, but it turns out that if the endpoint doesn't have any
@FormParam
we skip reading the body, which means I can't use these filters for some endpoints.I'd like to make these filters force the body to be read to avoid this issue.
Implementation ideas
No response
The text was updated successfully, but these errors were encountered: