Repository navigation
Description
Refiling #16456, which was closed for inactivity but still reproduces on main (b4f8b6756c6a7ddddeab1664b51dea1237740a6e, v2.39.4-devel+b4f8b67).
Current behavior
On the custom role editor (Organization → Roles → Create custom role), turning on Show advanced permissions lists every workspace action under workspace_dormant. Four of them can't be granted by anyone, including the site owner, so selecting any of them makes role creation fail:
workspace_dormant action |
Result |
|---|---|
application_connect |
400, not allowed to grant |
share |
400, not allowed to grant (new since #16456) |
ssh |
400, not allowed to grant |
start |
400, not allowed to grant |
create, create_agent, delete, delete_agent, read, stop, update, update_agent |
200 |
The API also returns only the first invalid permission, so when several are selected the user has to fix them one save at a time:
{"message":"Failed to update role permissions","detail":"org=\"<org-id>\": org: invalid permission for action=\"application_connect\" type=\"workspace_dormant\", not allowed to grant this permission"}Expected behavior
The UI shouldn't offer permissions that can never be granted. If the request still fails validation, the error should list every invalid permission at once.
Steps to reproduce
- On a Premium-licensed deployment, sign in as the site owner.
- Go to Admin settings → Organizations → (org) → Roles → Create custom role.
- Enter a name and turn on Show advanced permissions.
- Tick the
workspace_dormantgroup checkbox (or just one ofapplication_connect,share,ssh,start). - Click Create custom role. The request fails with the error above.
To confirm with the API, send POST /api/v2/organizations/{org}/members/roles as the owner with a single org permission {"resource_type":"workspace_dormant","action":"ssh"}. It returns 400.
Root cause
policy.gogivesworkspace_dormantthe fullworkspaceActionsset, so the generatedrbacresourcesGenerated.tsincludes all 12 actions.- With advanced permissions on,
CreateEditRolePageView.tsxrenders that full list with no filtering. - The owner role (
roles.go#L427) and org admin role (roles.go#L605) intentionally get onlyread, delete, create, update, stop, create_agent, delete_agent, update_agenton dormant workspaces. customRoleEscalationCheckrejects any permission the caller doesn't hold, andcustomRoleCheckstops at the first failure.
Possible fixes
- Hide (or disable with an explanation) actions the current user can't grant. One option is for the API to expose the grantable actions per resource instead of hardcoding exclusions in the frontend.
- Or narrow the
workspace_dormantaction list to the actions that make sense for dormant workspaces. - Have
customRoleCheckcollect every invalid permission and return them together.
Environment
- Coder
main@b4f8b6756c6a7ddddeab1664b51dea1237740a6e(v2.39.4-devel), run withscripts/develop.shand a Premium license - Originally reported against 2.18.5 and 2.19 in Custom Role UI shows unassignable permissions #16456
Created on behalf of @angrycub
Activity
linear-code commentedon Nov 16, 2026
ENG-3543