Uploaded image for project: 'Red Hat build of Keycloak'
  1. Red Hat build of Keycloak
  2. RHBK-3737

Group permission denies to view user [GHI#40965]

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      Before reporting an issue

      [x] 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

      admin/fine-grained-permissions

      Describe the bug

      I'm trying to implement the following permission scheme:

      • We have two groups /Root/group1 and /Root/group2
      • We have two admin groups /Admins/group1 and /Admins/group2
      • Each admin group should be able to manage the membership for their corresponding group, so e.g. /Admin/group1 should be able to manage the membership for /Root/group1

      I created three group policies:

      • Admins: applies to /Admins and extends to children
      • group1 / group2 apply to their respective /Admins/groupX group

      Then I created four permissions:

      • View users and manage group membership: This should allow all members in the admins group to view and manage the group membership for all users.
      • User policy
      • Scopes: manage-group-membership, view
      • Enforces access to: All users
      • Policy: Admins
      • View groups and members: This should allow all members in the admins group to view all groups and their members
      • Group policy
      • Scopes: view, view-members
      • Enforce access to: All Groups
      • Policies: Admins
      • One permission for each of group1 and group2 which should allow members of their admin group to manage the membership for the specific group:
      • Group Policy
      • Scopes: manage-membership
      • Enforce access to: /Root/group1
      • Policies: group1

      Finally, I have three users:

      • usera: member of /Admins/group1
      • userb: member of /Root/group2
      • userc: member of no group

      If we now evaluate the permissions of usera we get:

      • They can view and view-members on /Root/group1 and /Root/group2
      • They can manage-membership on /Root/group1
      • They can view and manage-group-membership of userc

      However, usera cannot do anything on userb, not even view them. The permission evaluation says that the manage membership of group2 permission voted DENY, which I find odd.
      Apparently, the fact that userb is part of the /Root/group2 group disallows usera to view them.

      Version

      26.3.0

      Regression

      [ ] The issue is a regression

      Expected behavior

      I would expect that the group permission for /Root/group2 operates on the group object, and as expected usera cannot manage the membership for group2. I wouldn't expect that this would have an effect on whether or not usera can e.g. view userb.

      Actual behavior

      The group permission influences whether usera can view userb because userb is part of the group allowed by the permission.

      How to Reproduce?

      1. Use the realm export realm-export-permissions-demo.json to import the realm.
      2. Create three users usera, userb, userc.
      3. Assign usera to group /Admins/group1.
      4. Assign userb to group /Root/group2.
      5. In the permissions evaluation tab, evaluate usera on Users resource type for user userb and see that all scopes are denied.

      ![Image](https://github.com/user-attachments/assets/8ab92aee-d0b1-47af-a3a3-276a6ad2aeb2)
      

      6. Evaluate the same but this time for users userc instead of userb and see that view and manage-group-membership are allowed.

      ![Image](https://github.com/user-attachments/assets/17f3a66d-98a4-488d-bf9d-22e72d0bfd08)
      

      Anything else?

      No response

              Unassigned Unassigned
              pvlha Pavel Vlha
              Keycloak Core IAM
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: