Repository navigation
Description
Motivation
Valkey's ACL system supports fine-grained user-level permissions (commands, keys, channels, databases). However, there is no way to define a shared, reusable set of permissions and apply it to multiple users at once.
This becomes a real operational pain when:
- Certificate-based authentication (Issue #1866) can create many users that logically belong to the same permission class.
- Hundreds of users share the same permission policy (e.g. all "customer" users). Updating a shared policy (e.g. adding
-@scriptingfor CVE remediation) requires updating every user individually. - No auditable structure. Without named roles, auditors must inspect every user individually to understand permission policies (e.g., no way to answer "which users have read-only access" without checking each one).
Prior discussions
- valkey-io/valkey#1771: feature request for ACL groups in Valkey.
- redis/redis#9195: ACL roles PR for Redis, closed in favor of ACL V2 selectors (redis/redis#9974).
Design
Core concepts
- A role is a named set of ACL rules. Including commands, keys, channels, and databases, but no passwords and flags. A role cannot be authenticated against directly.
- A user can belong to zero or more roles. The user holds pointers to its role selectors. During permission checks, the user's own selectors are checked first, then each role's selectors. All are evaluated with OR logic (consistent with existing selector semantics).
- Roles are flat. A role cannot contain another role. This avoids cyclic dependencies and keeps the model simple.
- Users can only add permissions on top of roles, not restrict them. Role selectors and user's own selectors are evaluated independently with OR logic. If any selector (role or user's own) allows a command, it is allowed. This is consistent with how multiple selectors already work in ACL V2.
- Role updates are zero-cost. Since users hold pointers to role objects, updating a role's selectors in-place is immediately visible to all members. No per-user rebuild needed.
New commands
| Command / Syntax | Description |
|---|---|
ACL SETROLE <name> <rules...> |
Create or update a role. Rules use the same syntax as ACL SETUSER minus password/on/off. |
ACL DELROLE <name> |
Delete a role. Fails if any users still reference it (safe deletion). |
ACL GETROLE <name> |
Show role permissions (commands, keys, channels, selectors, members). |
ACL ROLES |
List all roles. |
ACL SETUSER <user> +@role:<name> |
Assign a role to a user. |
ACL SETUSER <user> -@role:<name> |
Remove a role from a user. |
ACL file format example
# Roles
role customer ~* &* +@all -@admin -@dangerous -@scripting
role readonly ~* &* +@read
# Users
user alice on >password +@role:customer
user bob on >password +@role:readonly
user carol on >password +@role:customer +EVAL
ACL GETUSER output changes
The ACL GETUSER response adds a new roles field. The commands, keys, and channels fields show the user's own root selector permissions. Role selectors are not shown inline but can be inspected via ACL GETROLE.
> ACL GETUSER carol
1) "flags"
2) 1) "on"
3) "passwords"
4) 1) "..."
5) "commands"
6) "+eval" # user's own root selector
7) "keys"
8) ""
9) "channels"
10) ""
11) "selectors"
12) (empty array)
13) "roles" # NEW
14) 1) "customer" # NEW
ACL GETROLE output
> ACL GETROLE customer
1) "commands"
2) "+@all -@admin -@dangerous -@scripting"
3) "keys"
4) "~*"
5) "channels"
6) "&*"
7) "selectors"
8) (empty array)
9) "members"
10) 1) "alice"
11) 2) "carol"
ACL LIST output changes
> ACL LIST
1) "role customer ~* &* +@all -@admin -@dangerous -@scripting"
2) "user carol on #<hash> +@role:customer +eval"
Edge cases and considerations
-
Deleting a role that has members:
ACL DELROLEshould fail with an error if any users reference the role. The operator must first remove users from the role. This prevents accidental permission changes. -
Circular references: Not possible since roles cannot contain other roles (flat model).
-
Performance: Users hold pointers to role objects, so role updates are zero-cost (no per-user rebuild). The permission check adds one extra loop over role selectors, which is negligible for typical role counts.
-
Role name validation: Role names follow the same rules as usernames (no spaces).
-
Empty roles: Allowed. An empty role grants no permissions. This is useful for pre-creating roles before defining their rules.
-
Reset behavior:
ACL SETUSER alice resetclears role memberships along with everything else, consistent with resetting the user to defaults. -
Removing from a role: When a user is removed from a role (
-@role:<name>), the role pointer is removed from the user'sroleslist. The role's selectors are no longer checked for that user. -
User cannot restrict role permissions: This is by design. Since role selectors are evaluated independently (OR logic), a user's deny rules on their own root selector do not override role grants. This is consistent with how multiple selectors already work in ACL V2.
Activity
madolson commentedon Jun 1, 2026
Weekly meeting notes: We are going to sync offline about this to try to figure out a more cohesive solution to solve the problem.
hpatro commentedon Jun 8, 2026
Sharing summary of internal slack discussion for public visibility:
The team is aligning towards introducing a new resource called a role, which supports selectors (with multiple selectors allowed, consistent with how users work) and can be attached to one or more users.
This is useful for applying a consistent set of permissions across multiple users, reducing duplication, though it is worth noting that roles cannot be used to enforce deny permissions (known limitation with multiple selectors as well).
We can gauge if the above resource would be helpful to others and can build it for the community. @yang-z-o feel free to add if I missed anything.
[-][NEW] ACL Group[/-][+][NEW] ACL Role[/+]Add ACL role support (valkey-io#3967)