Skip to content

Scoped tokens can't read or activate dormant workspaces #32192

Open

Description

@EhabY

Found while checking the VS Code extension's OAuth scopes against v2.38.0 (coder/vscode-coder#1168).

A dormant workspace's RBAC object is workspace_dormant (Workspace.RBACObject in coderd/database/modelmethods.go), but no scope a token can request covers that type:

  • The coder:workspaces.* composites grant only workspace (compositePerms in coderd/rbac/scopes.go).
  • workspace_dormant:* is internal. Requesting it fails with API key scope "workspace_dormant:update" is internal and cannot be requested by a token.

So once a workspace is dormant, its owner's scoped token gets 404 for both GET /api/v2/workspaces/{id} and PUT /api/v2/workspaces/{id}/dormant. Only coder:all works. The same user's password session activates the workspace (200), so OAuth clients can't do what the dashboard does.

Repro

  1. As an admin, mark a member's workspace dormant: PUT /api/v2/workspaces/{id}/dormant with {"dormant": true}.
  2. As the member, create a token with coder:workspaces.operate coder:workspaces.access workspace:create workspace:update user:read.
  3. With that token, call GET /api/v2/workspaces/{id} and PUT /api/v2/workspaces/{id}/dormant with {"dormant": false}. Both return 404.

Suggested fix

Grant the dormant type next to the workspace type in coder:workspaces.operate, which already grants read and update on workspaces:

"coder:workspaces.operate": {
	ResourceTemplate.Type:           {policy.ActionRead},
	ResourceWorkspace.Type:          {policy.ActionWorkspaceStop, policy.ActionWorkspaceStart, policy.ActionRead, policy.ActionUpdate},
	ResourceWorkspaceDormant.Type:   {policy.ActionRead, policy.ActionUpdate},
	ResourceOrganizationMember.Type: {policy.ActionRead},
},

Alternatively, add workspace_dormant:read and workspace_dormant:update to externalLowLevel in coderd/rbac/scopes_catalog.go.

Activity

  1. linear-code commented on Nov 13, 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