-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Regression v2.0.2.Final: RolesAllowed check skipped when endpoint method payload POJO class is private #19177
Comments
cc @sberyozkin |
/cc @sberyozkin |
@lwitkowski Hi, I'm surprised it even works at the JAX-RS level given that the parameter class is |
@lwitkowski The logs in your tests show:
The returned key value is |
Thanks for looking into this @sberyozkin, you're right about log message showing 0 instead of 1, it was caused by package private modifier for I've just committed some fixes: lwitkowski/quarkus-role-bug@b3d6cb4
Regarding |
@lwitkowski Thanks, sure, it is just that the 3rd party message body readers/writers need to access this private static class - Jackson-based ones can drill into it, others can't (such as jsonb ones for ex - and there is no requirement for them to be able to do so). |
@sberyozkin Yes, I also suspect some |
I think we should probably explicitly disallow this. AFAIK interceptors can't be applied to these methods, as they basically have the same semantics as private methods. Even if we solve this issue it will likely just cause other problems down the road (e.g. things like @transactional likely won't work, as interceptors can't be applied). |
@stuartwdouglas Hey Stuart - can you please look into disabling it/failing the build if the body entity is private ? I've just had about a 1 day panic attack with #21571 :-), and it proved it was the same problem, if it is too hard to enforce then I can add a big warning to the docs ? |
Throw an exception instead Fixes quarkusio#19177
- do not skip methods with a private param - also do not evaluate methods that declare no interceptor bindings; these methods are skipped automatically - related to quarkusio#19177
- do not skip methods with a private param - also do not evaluate methods that declare no interceptor bindings; these methods are skipped automatically - related to quarkusio#19177
- do not skip methods with a private param - also do not evaluate methods that declare no interceptor bindings; these methods are skipped automatically - related to quarkusio#19177
- do not skip methods with a private param - also do not evaluate methods that declare no interceptor bindings; these methods are skipped automatically - related to quarkusio#19177 Co-authored-by: Ladislav Thon <[email protected]>
- do not skip methods with a private param - also do not evaluate methods that declare no interceptor bindings; these methods are skipped automatically - related to quarkusio#19177 Co-authored-by: Ladislav Thon <[email protected]>
Describe the bug
@RolesAllowed
annotation is ignored for endpoints, which methods have strongly-typed POJO as parameter, and if POJO class is inner and private.Quarkus v2.0.1.Final is the last version where it works correctly, staring from v2.0.2.Final it works as described.
Expected behavior
REST service should return http 401/403 and endpoint method/implementation should not be called.
Actual behavior
Endpoint method/implementation is executed and response is sent to the client despite missing JWT/role.
How to Reproduce?
Given
Quarkus: v2.0.2.Final or newer
Extensions:
cdi, oidc, resteasy, resteasy-jackson, security, smallrye-context-propagation
POST endpoint accepting payload as strongly-typed POJO private class, with
@RolesAllowed("some-group")
annotationWhen
When endpoint is requested without valid JWT or when 'groups' claim does not contain required group (role)
Sample code
Minimal reproducer project: https://github.com/lwitkowski/quarkus-role-bug/
Github Actions: https://github.com/lwitkowski/quarkus-role-bug/actions/runs/1090923795
The text was updated successfully, but these errors were encountered: