8000 service-account leaking in get users API with "exact" query parameter set · Issue #8849 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

service-account leaking in get users API with "exact" query parameter set #8849

Closed

Description

@msvechla

Describe the bug

Hello,

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

Anything else?

No response

Activity

  1. added
    kind/bug
    on Nov 18, 2021
  2. added
    area/admin/api
    on Dec 2, 2021
  3. msvechla commented on Jan 5, 2022

    @msvechla
    ContributorAuthor

    Is there any feedback on this? Or maybe a possible workaround to search for users without accidentally returning service accounts?

  4. pedroigor commented on Feb 16, 2023

    @pedroigor
    Contributor

    @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.

    @keycloak/ui wdyt?

  5. added
    area/admin/ui
    and removed on Feb 16, 2023
  6. added this to the 22.0.0 milestone on Feb 16, 2023
  7. sschu commented on Feb 17, 2023

    @sschu
    Contributor

    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.

  8. pedroigor commented on Feb 27, 2023

    @pedroigor
    Contributor

    @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.

  9. added a commit that references this issue on Mar 1, 2023
    0a85c53
  10. sschu commented on Mar 2, 2023

    @sschu
    Contributor

    @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).

  11. pedroigor commented on Mar 6, 2023

    @pedroigor
    Contributor

    @sschu I see it being helpful but we should show SAs only if wanted.

  12. modified the milestones: 22.0.0, 21.1.0 on Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/admin/apiarea/admin/uikind/bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0