Title: Shared workspaces: scoped tokens can't run `coder start`, and `use`-role users can't report usage · Issue #30423 · coder/coder · GitHub
Open Graph Title: Shared workspaces: scoped tokens can't run `coder start`, and `use`-role users can't report usage · Issue #30423 · coder/coder
X Title: Shared workspaces: scoped tokens can't run `coder start`, and `use`-role users can't report usage · Issue #30423 · coder/coder
Description: Found while auditing the VS Code extension's OAuth scopes (coder/vscode-coder#1138, coder/vscode-coder#1128). Both affect workspaces shared with another user. 1. coder start and coder update fail on a shared workspace with any scoped tok...
Open Graph Description: Found while auditing the VS Code extension's OAuth scopes (coder/vscode-coder#1138, coder/vscode-coder#1128). Both affect workspaces shared with another user. 1. coder start and coder update fail o...
X Description: Found while auditing the VS Code extension's OAuth scopes (coder/vscode-coder#1138, coder/vscode-coder#1128). Both affect workspaces shared with another user. 1. coder start and coder update fa...
Opengraph URL: https://github.com/coder/coder/issues/30423
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Shared workspaces: scoped tokens can't run `coder start`, and `use`-role users can't report usage","articleBody":"Found while auditing the VS Code extension's OAuth scopes (coder/vscode-coder#1138, coder/vscode-coder#1128). Both affect workspaces shared with another user.\n\n## 1. `coder start` and `coder update` fail on a shared workspace with any scoped token\n\nWith dynamic parameters, `prepWorkspaceBuild` (`cli/create.go`) resolves the owner with `OrganizationMember(org, owner)` and falls back to `User(owner)`. For a scoped token both fail:\n\n- `GET /api/v2/organizations/{org}/members/{user}` returns 404 for a token with `coder:workspaces.operate coder:workspaces.access workspace:create user:read user:read_personal`. It does so even for the caller's own membership. The review also reported a 500 with `organization:read`; I haven't re-verified that.\n- `GET /api/v2/users/{user}` returns 404 for another user, because `user:read` scoped this way only covers the caller.\n\nSo the CLI fails with:\n\n```\nget owning member: Resource not found or you do not have access to this resource\n```\n\nThe same user's unscoped session starts the workspace. A REST start build (`POST /api/v2/workspaces/{id}/builds`) with the same token also works, so only the CLI's owner lookup is blocked. `organization_member:read` is not a public low-level scope, so a client can't request it directly. Per the review, no scope short of `coder:all` avoids the failure.\n\n**Repro**\n1. Share a workspace with a member (ACL role `admin`) and stop it.\n2. As the member, create a token with the scopes above.\n3. Run `CODER_SESSION_TOKEN=\u003ctoken> coder start -y \u003cowner>/\u003cworkspace>`.\n\n**Expected:** the start succeeds. Either the member lookup works for scoped tokens with access to the workspace, or the CLI resolves the owner in a way such tokens can.\n\n## 2. Users shared a workspace with the `use` role can't report usage\n\n`POST /api/v2/workspaces/{id}/usage` authorizes `policy.ActionUpdate` on the workspace (`postWorkspaceUsage`, `coderd/workspaces.go`). The `use` workspace role (`db2sdk.go`) grants only:\n- `application_connect`\n- `read`\n- `ssh`\n- `workspace_start`\n- `workspace_stop`\n\nIt doesn't grant `update`, so `coder ssh --usage-app=…` (used by VS Code and others) can't report usage on such workspaces, whatever the token's scopes. `UpdateWorkspaceUsageWithBodyContext` only logs `failed to post workspace usage` as a warning, so the workspace's usage stops being recorded with no visible error.\n\n**Expected:** anyone allowed to SSH into or connect to the workspace can report usage. For example, authorize usage with `ssh` or `application_connect` instead of `update`, or add the needed action to the `use` role.\n","author":{"url":"https://github.com/EhabY","@type":"Person","name":"EhabY"},"datePublished":"2026-10-06T12:43:35Z","url":"https://github.com/coder/coder/issues/30423"}
| 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:e973c036-1f6c-3137-f39a-a2c40fa6dd35 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 82AA:2F9718:C1ACAE:104BD84:6B00FEB7 |
| html-safe-nonce | f969924ce6dcd13ba4937357268b06f158b408d1becc17ba6f7f41607f8ea85c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MkFBOjJGOTcxODpDMUFDQUU6MTA0QkQ4NDo2QjAwRkVCNyIsInZpc2l0b3JfaWQiOiI2NTAyMjU2MzQyNDYyNDMwOTAzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c768a072c572fcb634731d85f4b6814410a29ecf4d9cda460c9e93568eb0aa22 |
| hovercard-subject-tag | issue:5728580738 |
| 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/30423/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d6bc7b5fdbcd511227a51edc198f027b6c58b8ae67eb2879d9dac5a01e9c7575/coder/coder/issues/30423 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d6bc7b5fdbcd511227a51edc198f027b6c58b8ae67eb2879d9dac5a01e9c7575/coder/coder/issues/30423 |
| og:image:alt | Found while auditing the VS Code extension's OAuth scopes (coder/vscode-coder#1138, coder/vscode-coder#1128). Both affect workspaces shared with another user. 1. coder start and coder update fail o... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | EhabY |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width