Skip to content

Custom role editor offers workspace_dormant permissions that can never be granted #32263

Open

Description

@coder

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

  1. On a Premium-licensed deployment, sign in as the site owner.
  2. Go to Admin settings → Organizations → (org) → Roles → Create custom role.
  3. Enter a name and turn on Show advanced permissions.
  4. Tick the workspace_dormant group checkbox (or just one of application_connect, share, ssh, start).
  5. 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

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_dormant action list to the actions that make sense for dormant workspaces.
  • Have customRoleCheck collect every invalid permission and return them together.

Environment

Created on behalf of @angrycub

Activity

  1. linear-code commented on Nov 16, 2026

    @linear-code
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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions