Title: Custom role editor offers workspace_dormant permissions that can never be granted · Issue #32263 · coder/coder · GitHub
Open Graph Title: Custom role editor offers workspace_dormant permissions that can never be granted · Issue #32263 · coder/coder
X Title: Custom role editor offers workspace_dormant permissions that can never be granted · Issue #32263 · coder/coder
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), turn...
Open Graph 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 (Organiza...
X 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 (Organiza...
Opengraph URL: https://github.com/coder/coder/issues/32263
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Custom role editor offers workspace_dormant permissions that can never be granted","articleBody":"Refiling #16456, which was closed for inactivity but still reproduces on `main` (`b4f8b6756c6a7ddddeab1664b51dea1237740a6e`, `v2.39.4-devel+b4f8b67`).\n\n### Current behavior\n\nOn 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:\n\n| `workspace_dormant` action | Result |\n| --- | --- |\n| `application_connect` | 400, not allowed to grant |\n| `share` | 400, not allowed to grant (new since #16456) |\n| `ssh` | 400, not allowed to grant |\n| `start` | 400, not allowed to grant |\n| `create`, `create_agent`, `delete`, `delete_agent`, `read`, `stop`, `update`, `update_agent` | 200 |\n\nThe API also returns only the first invalid permission, so when several are selected the user has to fix them one save at a time:\n\n```json\n{\"message\":\"Failed to update role permissions\",\"detail\":\"org=\\\"\u003corg-id>\\\": org: invalid permission for action=\\\"application_connect\\\" type=\\\"workspace_dormant\\\", not allowed to grant this permission\"}\n```\n\n### Expected behavior\n\nThe 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.\n\n### Steps to reproduce\n\n1. On a Premium-licensed deployment, sign in as the site owner.\n2. Go to **Admin settings → Organizations → (org) → Roles → Create custom role**.\n3. Enter a name and turn on **Show advanced permissions**.\n4. Tick the `workspace_dormant` group checkbox (or just one of `application_connect`, `share`, `ssh`, `start`).\n5. Click **Create custom role**. The request fails with the error above.\n\nTo 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.\n\n### Root cause\n\n- [`policy.go`](https://github.com/coder/coder/blob/b4f8b6756c6a7ddddeab1664b51dea1237740a6e/coderd/rbac/policy/policy.go#L157) gives `workspace_dormant` the full `workspaceActions` set, so the generated [`rbacresourcesGenerated.ts`](https://github.com/coder/coder/blob/b4f8b6756c6a7ddddeab1664b51dea1237740a6e/site/src/api/rbacresourcesGenerated.ts#L295) includes all 12 actions.\n- With advanced permissions on, [`CreateEditRolePageView.tsx`](https://github.com/coder/coder/blob/b4f8b6756c6a7ddddeab1664b51dea1237740a6e/site/src/pages/OrganizationSettingsPage/CustomRolesPage/CreateEditRolePageView.tsx#L208-L210) renders that full list with no filtering.\n- The owner role ([`roles.go#L427`](https://github.com/coder/coder/blob/b4f8b6756c6a7ddddeab1664b51dea1237740a6e/coderd/rbac/roles.go#L427)) and org admin role ([`roles.go#L605`](https://github.com/coder/coder/blob/b4f8b6756c6a7ddddeab1664b51dea1237740a6e/coderd/rbac/roles.go#L605)) intentionally get only `read, delete, create, update, stop, create_agent, delete_agent, update_agent` on dormant workspaces.\n- [`customRoleEscalationCheck`](https://github.com/coder/coder/blob/b4f8b6756c6a7ddddeab1664b51dea1237740a6e/coderd/database/dbauthz/dbauthz.go#L1633) rejects any permission the caller doesn't hold, and [`customRoleCheck`](https://github.com/coder/coder/blob/b4f8b6756c6a7ddddeab1664b51dea1237740a6e/coderd/database/dbauthz/dbauthz.go#L1646) stops at the first failure.\n\n### Possible fixes\n\n- 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.\n- Or narrow the `workspace_dormant` action list to the actions that make sense for dormant workspaces.\n- Have `customRoleCheck` collect every invalid permission and return them together.\n\n### Environment\n\n- Coder `main` @ `b4f8b6756c6a7ddddeab1664b51dea1237740a6e` (`v2.39.4-devel`), run with `scripts/develop.sh` and a Premium license\n- Originally reported against 2.18.5 and 2.19 in #16456\n\nCreated on behalf of @angrycub\n","author":{"url":"https://github.com/apps/coder","@type":"Person","name":"coder"},"datePublished":"2026-11-16T16:35:35Z","url":"https://github.com/coder/coder/issues/32263"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d25e3ee2-f55e-e3bd-51af-6143647eff58 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8548:BEE9A:98D330:D662C4:6B042D87 |
| html-safe-nonce | 83ac8d3b69c0ebd29fe32618ed827f1aa2daf903792af94cfab9043163a58cd1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTQ4OkJFRTlBOjk4RDMzMDpENjYyQzQ6NkIwNDJEODciLCJ2aXNpdG9yX2lkIjoiMzU1MDg2NDU4MzEzMDYyMzM2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f7790c9f55459bfcaed1fbfdf31e1ee81d54321c9f7395e4aa5fd9a3e9907480 |
| hovercard-subject-tag | issue:6425879114 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/32263/issue_layout |
| twitter:image | https://opengraph.githubassets.com/174afce45d220d7b2fc260a641e869a1c34ac7044da3b6ba7c3543abaf83926e/coder/coder/issues/32263 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/174afce45d220d7b2fc260a641e869a1c34ac7044da3b6ba7c3543abaf83926e/coder/coder/issues/32263 |
| og:image:alt | 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 (Organiza... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | coder[bot] |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width