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
{{ message }}
Repository navigation
service-account leaking in get users API with "exact" query parameter set #8849
area/admin/apiAdmin REST API (v1) — managing realms, users, clients, roles, groupsarea/admin/uiAdmin Console — React UI for server administrationkind/bugCategorizes a PR related to a bug
When calling the GET /{realm}/users endpoint with the optional query parameter exact set to any value, without specifying any other query parameters, the list of users also contains service-account users from the clients with Service Accounts enabled in that realm.
It seems like this is a bug, because when this optional query parameter is not set, those service-account users are never returned.
If this is the intended behavior, I would expect to be able to replicate the default behavior by specifying exact=true or exact=false (whatever the default currently is).
In case I misunderstood something, is there a way to reliably filter out the service-account users when specifying the exact query parameter?
Thanks a lot for your help!
Version
15.0.2
8000
Expected behavior
service-account users not showing up in the GET /{realm}/users endpoint, or otherwise consistent behavior when specifying or omitting the exact query parameter
Actual behavior
service-account users showing up when setting the exact query parameter to any value
How to Reproduce?
create a new realm
create a dummy OIDC client in the realm
setting "Service Accounts Enabled" on the newly created client client
calling GET /{realm}/users?exact=true or GET /{realm}/users?exact=false
When simply calling GET /{realm}/users, the service-account user does not show up
@msvechla There isn't. As you can see here, service accounts are always included when exact is set.
We should probably include a specific parameter to properly configure if SAs are supposed to be included.
This should have some impact on the administration console too because today we are showing SAs. IMO, when querying users we should not show SAs at all.
This is actually a change from the behaviour in the old console. Apparently, the new console uses a special endpoint /admin/realms/master/admin-ui-brute-force-user that includes service account users per default while the old console just used the normal /admin/realms/master/users endpoint from the admin api that excludes service account users.
@pedroigor I talked to our customers and there wasn't really a very convincing use case. They definitely sometimes access the service account user directly for example to add custom attributes to it. That would be a bit easier if they could also list them (currently they access them directly via id).
area/admin/apiAdmin REST API (v1) — managing realms, users, clients, roles, groupsarea/admin/uiAdmin Console — React UI for server administrationkind/bugCategorizes a PR related to a bug
Activity
msvechla commentedon Jan 5, 2022
Is there any feedback on this? Or maybe a possible workaround to search for users without accidentally returning service accounts?
pedroigor commentedon Feb 16, 2023
@msvechla There isn't. As you can see here, service accounts are always included when
exactis set.We should probably include a specific parameter to properly configure if SAs are supposed to be included.
This should have some impact on the administration console too because today we are showing SAs. IMO, when querying users we should not show SAs at all.
@keycloak/ui wdyt?
sschu commentedon Feb 17, 2023
This is actually a change from the behaviour in the old console. Apparently, the new console uses a special endpoint
/admin/realms/master/admin-ui-brute-force-userthat includes service account users per default while the old console just used the normal/admin/realms/master/usersendpoint from the admin api that excludes service account users.pedroigor commentedon Feb 27, 2023
@sschu Does it make sense to show SAs at all? In the worst case, have an option to also include SAs in the response.
For me, SAs users are an internal thing and should not be exposed.
don't include service accounts in search results (#17189)
sschu commentedon Mar 2, 2023
@pedroigor I talked to our customers and there wasn't really a very convincing use case. They definitely sometimes access the service account user directly for example to add custom attributes to it. That would be a bit easier if they could also list them (currently they access them directly via id).
pedroigor commentedon Mar 6, 2023
@sschu I see it being helpful but we should show SAs only if wanted.