You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the Keycloak admin console from a private window to sign-out the user. The bug will occur naturally if the Keycloak session is allowed to time out but this speeds up the test.
Refresh the playground screen until it returns to the login page.
Login again, this time as pguser
Claims now contains pgadmin’s roles as well as pguser’s roles:
User sessions should be cleared in the login flow because there may not have been an explicit logout action to do this.
The growing array bug is caused by the use of defu() which I replaced a more explicit copy of UserSession data from the refreshed token into the session.
The text was updated successfully, but these errors were encountered:
Description
Session data from one user's session will leak into a new user's session if:
A somewhat related issue is that optionalClaims which are complex types containing arrays "grow" each time the session is refreshed.
I have fixed both problems in my fork here and will open a PR: https://github.com/theolint/nuxt-oidc-auth
Steps to Reproduce
I reproduced this issue with Keycloak on commit bc044d9, with Keycloak configured to add roles to the ID token (which is non-standard)
Keycloak Instance Config
master
playground
with client authenticationadmin-role
anduser-role
pgadmin
with playground roleadmin-role
andpguser
with playground roleuser-role
roles
scopeclient roles
mapperVerify that pgadmin gets the following claim in the ID token:
and that pguser gets a similar claim with
user-role
insteadPlayground Config
Configure keyclock provider in nuxt-oidc-auth playground. Set optionalClaims to pull in
resource_access
claim.Testing
Open playground app and login with Keycloak as
pgadmin
. Observe that claims containsadmin-role
.On my first test, it actually included
admin-role
twice:Which is not what is in the ID token:
Which has a payload part that decodes to:
Re-Creating Error
Use the Keycloak admin console from a private window to sign-out the user. The bug will occur naturally if the Keycloak session is allowed to time out but this speeds up the test.
Refresh the playground screen until it returns to the login page.
Login again, this time as
pguser
Claims now contains pgadmin’s roles as well as pguser’s roles:
The ID token only contains the expected roles:
Above ID token for
pguser
decoded payload:Claims Merging Bug
Refreshing the session repeatedly will keep appending array items nested within a claim that is an object:
Fix
User sessions should be cleared in the login flow because there may not have been an explicit logout action to do this.
The growing array bug is caused by the use of defu() which I replaced a more explicit copy of UserSession data from the refreshed token into the session.
The text was updated successfully, but these errors were encountered: