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

OIDC "Permission must not be empty" with imported test realm since 3.5.0 #36911

Closed
HerrDerb opened this issue Nov 7, 2023 · 7 comments · Fixed by #36920
Closed

OIDC "Permission must not be empty" with imported test realm since 3.5.0 #36911

HerrDerb opened this issue Nov 7, 2023 · 7 comments · Fixed by #36920
Assignees
Labels
area/oidc kind/bug Something isn't working
Milestone

Comments

@HerrDerb
Copy link
Contributor

HerrDerb commented Nov 7, 2023

Describe the bug

In certain projects, we use a realm.json to initialize the keycloak dev instance for our tests.
This did work fine prior 3.5.0

Since 3.5.0 we do get an exception as soon as we try to send an authorized request to a REST api during a test:

Caused by: java.lang.IllegalArgumentException: Permission name must not be empty
                at io.quarkus.security.StringPermission.validateAndTrim(StringPermission.java:48)
                at io.quarkus.security.StringPermission.<init>(StringPermission.java:26)
                at io.quarkus.oidc.runtime.OidcUtils.transformScopesToPermissions(OidcUtils.java:314)
                at io.quarkus.oidc.runtime.OidcUtils$1.<init>(OidcUtils.java:288)
                at io.quarkus.oidc.runtime.OidcUtils.addTokenScopesAsPermissions(OidcUtils.java:286)
                at io.quarkus.oidc.runtime.OidcUtils.setSecurityIdentityPermissions(OidcUtils.java:281)
                at io.quarkus.oidc.runtime.OidcUtils.validateAndCreateIdentity(OidcUtils.java:270)
                at io.quarkus.oidc.runtime.OidcIdentityProvider.createSecurityIdentityWithOidcServer(OidcIdentityProvider.java:284)

As nothing is noted as a breaking change concerning oidc in 3.5.0 and the imported realm.json seems valid, I must assume that this is bug?

PS: Mabey our keycloak "test tool" to add users, roles etc. could be distilled and integrated in quarkus?

How to Reproduce?

Run tests:
https://github.com/HerrDerb/quarkus-issue/tree/oidc-3-5-0-issue

Switch to Quarkus version 3.4.3 and the test will succeed.

@HerrDerb HerrDerb added the kind/bug Something isn't working label Nov 7, 2023
@quarkus-bot quarkus-bot bot added the area/oidc label Nov 7, 2023
Copy link

quarkus-bot bot commented Nov 7, 2023

/cc @pedroigor (oidc), @sberyozkin (oidc)

@michalvavrik michalvavrik self-assigned this Nov 7, 2023
@sberyozkin
Copy link
Member

sberyozkin commented Nov 7, 2023

Might be related to my previous fix related to treating scopes like read:data correctly, my guess is there is extra space or may be an unusual scope value that has not been taken into the consideration

@HerrDerb
Copy link
Contributor Author

HerrDerb commented Nov 7, 2023

In this very case the scope value is [""] which maybe unwanted slips on this line:

@michalvavrik
Copy link
Member

In this very case the scope value is [""]

yes, I could reproduce it thanks to your quality reproduce, I'll provide fix today, thanks for reporting it!

@michalvavrik
Copy link
Member

PS: Mabey our keycloak "test tool" to add users, roles etc. could be distilled and integrated in quarkus?

please let's treat it as a separate issue (maybe you can open enhancement issue), because this fix needs to be backported and discussion over this would only slow process down

@HerrDerb
Copy link
Contributor Author

HerrDerb commented Nov 7, 2023

please let's treat it as a separate issue (maybe you can open enhancement issue), because this fix needs to be backported and discussion over this would only slow process down

Absolutly, I did not intend to include this in the solution of this issue.

@HerrDerb
Copy link
Contributor Author

HerrDerb commented Nov 7, 2023

Sweet, thanks 🥳

@gsmet gsmet modified the milestones: 3.6 - main, 3.5.1 Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/oidc kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants