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

Failing to apply @SecureField to a generic with nested objects. #44646

Closed
suchwerk opened this issue Nov 22, 2024 · 2 comments · Fixed by #44669
Closed

Failing to apply @SecureField to a generic with nested objects. #44646

suchwerk opened this issue Nov 22, 2024 · 2 comments · Fixed by #44669
Labels
Milestone

Comments

@suchwerk
Copy link
Contributor

Describe the bug

In nested objects @SecureField has no effect. The price field is annotated with: @SecureField(rolesAllowed = "admin") but its still visible in the response also if the user has no admin role

Expected behavior

Expected Result: The test should pass with the following assertions:

With admin credentials (alice), the response should have a status code of 200 and the price field should be 1.0.

Without admin credentials (bob), the response should have a status code of 200 and the price field should be null.

Actual behavior

Actual Result: The test fails because the price field value does not match the expected values.

How to Reproduce?

https://github.com/suchwerk/secure-field-nested-issue

run the test

Output of uname -a or ver

No response

Output of java -version

21

Quarkus version or git rev

3.16.4

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Copy link

quarkus-bot bot commented Nov 22, 2024

/cc @FroMage (rest), @geoand (rest), @pedroigor (bearer-token), @sberyozkin (bearer-token,jwt,security), @stuartwdouglas (rest)

@michalvavrik
Copy link
Member

Thanks @suchwerk . I know what you mean by the issue title and description, but in case someone else reads this - this is scenario with generics and nested objects. We do have plenty of tests for nested objects alone, though as we discussed, detection can get real tricky.

@suchwerk suchwerk changed the title Failing to apply @SecureField to nested objects. Failing to apply @SecureField to a generic with nested objects. Nov 22, 2024
@quarkus-bot quarkus-bot bot added this to the 3.18 - main milestone Nov 25, 2024
@gsmet gsmet modified the milestones: 3.18 - main, 3.17.1 Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants