Skip to content

feat: grant resource roles to groups #316

Closed

Description

@uniqueg

Why?

Apps want to grant resource-scoped roles to groups, not only to individual users. Example: in elixir-cloud-aai/cloud-registry, a service could be owned by a team that a node maintains as a group in Perun / LS Login (released in eduperson_entitlement), so that team changes are handled centrally instead of per resource.

FOCA's resource role model (resource_role_model.conf, g2 = _, _, _) could express this (g2, group:<entitlement>, owner, /services/X), and is_permitted() already checks each group-derived subject. Two things prevent it today:

  1. Unmapped groups are dropped when group_mapping is set (get_current_groups() in foca/security/access_control/enforcement.py). Apps that map an admin group (as cloud-registry does) lose all other group claim values, so they cannot be subjects of rules unless every group is listed in the mapping, which is deployment configuration.
  2. The resource role helpers only handle users. add_resource_role(), remove_resource_role() and list_resource_roles() always add subject_prefix (user:), so rules for group:<value> subjects cannot be created, removed or listed through them.

How?

  1. Add an option (e.g., access_control.keep_unmapped_groups, default False for compatibility) that keeps claim values without a mapping as group:<value> subjects alongside the mapped roles.
  2. Let the resource role helpers handle group subjects, e.g., via a subject_type argument (user or group, default user), and return the subject type when listing.
  3. Expose the raw group claim values of the current request (e.g., get_current_groups(mapped=False) or a new helper), so that apps can enforce rules such as "users may only grant roles to groups they are a member of".
  4. Document the pattern (resource ownership by groups), including the security considerations: who may grant roles to which groups is app policy.

Acceptance criteria

  • With the option enabled, a role granted to group:<value> on a resource applies to every user whose group claim contains <value>, also when group_mapping is set.
  • With the default, behavior is unchanged.
  • Group subjects can be granted, revoked and listed via the helpers; user and group subjects cannot collide.
  • Tests and documentation.

Target: v0.15.0. Related: elixir-cloud-aai/cloud-registry#101 (invitations), the first user of resource-scoped roles.

Activity

  1. added this to the v0.15.0 milestone on Oct 20, 2026
  2. uniqueg commented on Oct 20, 2026

    @uniqueg
    MemberAuthor

    Implemented in #319 (merged into dev): an option keep_group_subjects keeps all group values as subjects, and the resource-role helpers accept group subjects (subject_type="group"). Roles that look like subjects cannot be granted; legacy rules of that kind are logged as warnings on the first policy load. Will be released with v0.15.0.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions