Skip to content

Built-in low-level scope catalog (resource:action) #19847

Description

@ThomasK33

Description

  • Derive low-level API key scope names directly from policy.RBACPermissions (coderd/rbac/policy/policy.go). For each resource’s allowed actions, expose <resource>:<action> scope names (e.g., template:use, workspace:start, workspace:ssh, api_key:create).
  • Introduce a collection of public low-level scope names that are exposed via an API endpoint for discovery and request by users/clients.
  • Support internal-only low-level scopes that are not exposed via the public catalog and cannot be requested by users, but may be attached by the system where needed.

Key files/areas

  • coderd/rbac/policy/policy.go (source of truth: RBACPermissions and policy.Action*).
  • coderd/rbac/scopes.go (expansion logic and mapping from scope string → RBAC permissions).
  • API surface to list public scope names (e.g., handler under coderd/ and OpenAPI docs) and validation in token creation to allow only public names.

Acceptance criteria

  • Table-driven tests validate that for every <resource>:<action> pair in RBACPermissions, if marked public, the corresponding scope exists and expands to the expected rbac.Scope.Site permissions.
  • No org-level permissions present in these expansions.
  • Public listing endpoint returns only public low-level scopes; internal-only scopes are not listed and cannot be requested (token creation with internal-only scope is rejected).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions