-
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
Prevent possible NPE in OIDC BackChannelLogoutHandler #29037
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay, just added a minor observation
@@ -59,6 +59,9 @@ public void handle(RoutingContext context) { | |||
LOG.debugf( | |||
"Tenant configuration for the tenant %s is not available or does not match the backchannel logout path", | |||
oidcTenantConfig.getTenantId().get()); | |||
context.response().setStatusCode(400); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish we could include the reason in the response. Returning a client error without any reason will make it harder to debug situations where this happens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gastaldi I see, but note this one will be returned to Keycloak directly, not to Quarkus user; besides this is a case where the fact Quarkus can't find the matching configuration is probably not something we'd like to say to the outside world, logging it for the users to trace seems reasonable. Perhaps we can make this one an ERROR-level message though, what do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if that's a good idea as clients could easily fill the logs with this information because the request is invalid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gastaldi I changed the log level to error
, hope it is better
@sberyozkin no 2.13 backport, it's a new feature in 2.14? |
Sorry, forgot 2.14 has been branched :-) |
9a01340
to
0ff7788
Compare
This comment has been minimized.
This comment has been minimized.
@gastaldi I've checked the spec, they only advise |
0ff7788
to
7ed539c
Compare
As discovered by @pjgg, OIDC
BackChannelLogoutHandler
can throw NPE if no tenant configuration matching the back channel logout request has been found.BackChannelLogoutHandler
checks if the tenant context is null and logs a message but currently forgets end the request, leading to a later NPE where this context is accessed.OIDC back channel logout spec requires
400
be returned if the logout request is invalid or has failed for whatever reasons, so 400 is returned in this case, https://openid.net/specs/openid-connect-backchannel-1_0.html#BCResponse