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

quarkus.security.jaxrs.deny-unannotated-endpoints=true does overrule @TestSecurity(authorizationEnabled = false) #19896

Closed
TheParad0X opened this issue Sep 3, 2021 · 5 comments · Fixed by #19955
Labels
area/security kind/bug Something isn't working
Milestone

Comments

@TheParad0X
Copy link

Describe the bug

As mentioned here, I was asked to open this issue:

My (REST) Tests are all annotated with io.quarkus.test.security.TestSecurity's
@TestSecurity(authorizationEnabled = false)

When adding
quarkus.security.jaxrs.deny-unannotated-endpoints=true
they all fail with a 401 (thus ignoring the authorizationEnabled flag)

Is this the intended behavior?

Expected behavior

To me, @testsecurity(authorizationEnabled = false) should disable security for any endpoint, annotated or not.

Actual behavior

quarkus.security.jaxrs.deny-unannotated-endpoints=true does overrule @testsecurity(authorizationEnabled = false)

As a Workaround, I had to use
@TestSecurity(user = "testUser", roles = {"admin"})

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment Temurin-11.0.12+7 (build 11.0.12+7) OpenJDK 64-Bit Server VM Temurin-11.0.12+7 (build 11.0.12+7, mixed mode)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.1.2.Final

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

Apache Maven 3.8.2

Additional information

No response

@TheParad0X TheParad0X added the kind/bug Something isn't working label Sep 3, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Sep 3, 2021

/cc @sberyozkin

@TheParad0X TheParad0X changed the title quarkus.security.jaxrs.deny-unannotated-endpoints=true does overrule @TestSecurity(authorizationEnabled = false)? quarkus.security.jaxrs.deny-unannotated-endpoints=true does overrule @TestSecurity(authorizationEnabled = false) Sep 3, 2021
@geoand
Copy link
Contributor

geoand commented Sep 3, 2021

@sberyozkin @FroMage @stuartwdouglas what do you believe the expected behavior to be?

I believe @TestSecurity should "win".

@sberyozkin
Copy link
Member

Makes sense

@stuartwdouglas
Copy link
Member

This does not sound right, deny-unannotated-endpoints should be basically doing a @DenyAll, so adding a username and roles should have no effect.

@geoand
Copy link
Contributor

geoand commented Sep 7, 2021

I'll have a look

geoand added a commit to geoand/quarkus that referenced this issue Sep 7, 2021
…ecurity feature

The use of `quarkus.security.jaxrs.deny-unannotated-endpoints=true` essentially
results in the addition of a `DenyAllInterceptor` to the invocation chain
of a JAX-RS endpoint.
Because this interceptor did not take into account the `AuthorizationController`
(like the `RolesAllowedInterceptor` already does), it would result in endpoints
being secured even though security was supposed to be disabled for the specific test.

Fixes: quarkusio#19896
geoand added a commit to geoand/quarkus that referenced this issue Sep 7, 2021
…ecurity feature

The use of `quarkus.security.jaxrs.deny-unannotated-endpoints=true` essentially
results in the addition of a `DenyAllInterceptor` to the invocation chain
of a JAX-RS endpoint.
Because this interceptor did not take into account the `AuthorizationController`
(like the `RolesAllowedInterceptor` already does), it would result in endpoints
being secured even though security was supposed to be disabled for the specific test.

Fixes: quarkusio#19896
geoand added a commit that referenced this issue Sep 8, 2021
Make @testsecurity work correctly with unannotated JAX-RS endpoints security feature
@quarkus-bot quarkus-bot bot added this to the 2.3 - main milestone Sep 8, 2021
@gsmet gsmet modified the milestones: 2.3.0.CR1, 2.2.4.Final Nov 30, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Dec 1, 2021
…ecurity feature

The use of `quarkus.security.jaxrs.deny-unannotated-endpoints=true` essentially
results in the addition of a `DenyAllInterceptor` to the invocation chain
of a JAX-RS endpoint.
Because this interceptor did not take into account the `AuthorizationController`
(like the `RolesAllowedInterceptor` already does), it would result in endpoints
being secured even though security was supposed to be disabled for the specific test.

Fixes: quarkusio#19896
(cherry picked from commit b9359bf)
gsmet pushed a commit to gsmet/quarkus that referenced this issue Dec 1, 2021
…ecurity feature

The use of `quarkus.security.jaxrs.deny-unannotated-endpoints=true` essentially
results in the addition of a `DenyAllInterceptor` to the invocation chain
of a JAX-RS endpoint.
Because this interceptor did not take into account the `AuthorizationController`
(like the `RolesAllowedInterceptor` already does), it would result in endpoints
being secured even though security was supposed to be disabled for the specific test.

Fixes: quarkusio#19896
(cherry picked from commit b9359bf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants