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

Uncaught server error: java.lang.IllegalArgumentException: Path parameter not provided #27514

Closed
1 of 2 tasks
monneyboi opened this issue Mar 4, 2024 · 5 comments · Fixed by #27542
Closed
1 of 2 tasks
Assignees
Labels
Milestone

Comments

@monneyboi
Copy link

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

oidc

Describe the bug

I'm trying to create a Client Role in Keycloak for using a RabbitMQ Topic exchange. RabbitMQ allows for variable expansion based on token claims, using roles like rabbitmq.write:*/q-{vhost}-*/u-{sub}-*

When i try to create this Client Role though, keycloak appears to substitute the {sub}, for which it has no value, resulting in a HTTP 500.

I can find no documentation on the substitution behaviour. Is there a way i can disable this substitution?

Version

24.0

Regression

  • The issue is a regression

Expected behavior

The Client Role gets created.

Actual behavior

No role gets created, the server returns a HTTP 500 and outputs:

2024-03-04 20:24:08,136 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-22) Uncaught server error: java.lang.IllegalArgumentException: Path parameter not provided sub
        at org.jboss.resteasy.reactive.common.jaxrs.UriBuilderImpl.replaceParameter(UriBuilderImpl.java:635)
        at org.jboss.resteasy.reactive.common.jaxrs.UriBuilderImpl.buildCharSequence(UriBuilderImpl.java:562)
        at org.jboss.resteasy.reactive.common.jaxrs.UriBuilderImpl.buildString(UriBuilderImpl.java:534)
        at org.jboss.resteasy.reactive.common.jaxrs.UriBuilderImpl.buildFromValues(UriBuilderImpl.java:747)
        at org.jboss.resteasy.reactive.common.jaxrs.UriBuilderImpl.build(UriBuilderImpl.java:741)
        at org.keycloak.services.resources.admin.RoleContainerResource.createRole(RoleContainerResource.java:205)
        at org.keycloak.services.resources.admin.RoleContainerResource$quarkusrestinvoker$createRole_190d62669e914fdb6072e019d245fdf3f1acb997.invoke(Unknown Source)
        at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
        at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141)
        at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
        at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:582)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:840)

How to Reproduce?

  • Create a client
  • Create a Client Role with this {pattern} in the name

Anything else?

No response

@monneyboi monneyboi added kind/bug Categorizes a PR related to a bug status/triage labels Mar 4, 2024
@keycloak-github-bot keycloak-github-bot bot added area/oidc Indicates an issue on OIDC area team/core-clients labels Mar 4, 2024
@graziang graziang self-assigned this Mar 5, 2024
@graziang
Copy link
Contributor

graziang commented Mar 5, 2024

Hi, when you build the URL to return in the response location here, UriBuilder tries to resolve the parameters of the template contained in the role name.
This can be easily fixed by avoiding template resolution when encoding the role name.

@keycloak-github-bot
Copy link

Due to the amount of issues reported by the community we are not able to prioritise resolving this issue at the moment.

If you are affected by this issue, upvote it by adding a 👍 to the description. We would also welcome a contribution to fix the issue.

graziang added a commit to graziang/keycloak that referenced this issue Mar 5, 2024
The role is encoded to avoid template resolution by the URIBuilder. This fix avoids the exception when creating roles with names containing {patterns}.

Closes keycloak#27514

Signed-off-by: graziang <g.graziano94@gmail.com>
graziang added a commit to graziang/keycloak that referenced this issue Mar 6, 2024
The role is encoded to avoid template resolution by the URIBuilder. This fix avoids the exception when creating roles with names containing {patterns}.

Closes keycloak#27514

Signed-off-by: graziang <g.graziano94@gmail.com>
mposolda pushed a commit that referenced this issue Mar 6, 2024
The role is encoded to avoid template resolution by the URIBuilder. This fix avoids the exception when creating roles with names containing {patterns}.

Closes #27514

Signed-off-by: graziang <g.graziano94@gmail.com>
@mposolda mposolda added this to the 25.0.0 milestone Mar 6, 2024
ahus1 pushed a commit to ahus1/keycloak that referenced this issue Mar 22, 2024
The role is encoded to avoid template resolution by the URIBuilder. This fix avoids the exception when creating roles with names containing {patterns}.

Closes keycloak#27514

Signed-off-by: graziang <g.graziano94@gmail.com>
@jonkoops
Copy link
Contributor

@mposolda this sounds like something that would justify a backport to 24, no?

@graziang
Copy link
Contributor

@jonkoops I agree as just yesterday a related issue #28203 was opened, preparing the PR for backport.

@jonkoops
Copy link
Contributor

Thanks @graziang!

graziang added a commit to graziang/keycloak that referenced this issue Mar 28, 2024
The role is encoded to avoid template resolution by the URIBuilder. This fix avoids the exception when creating roles with names containing {patterns}.

Closes keycloak#27514

Signed-off-by: graziang <g.graziano94@gmail.com>
(cherry picked from commit 39299ee)
ahus1 pushed a commit that referenced this issue Apr 18, 2024
The role is encoded to avoid template resolution by the URIBuilder. This fix avoids the exception when creating roles with names containing {patterns}.

Closes #27514

Signed-off-by: graziang <g.graziano94@gmail.com>
(cherry picked from commit 39299ee)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants