Files
coder/site/src/api/rbacresourcesGenerated.ts
T
Michael Suchacz 7ca7c30f40 feat: add group and user ACLs to MCP server configs (#27944)
Adds group and user ACLs to org-scoped MCP server configs so
organizations can restrict specific MCP servers to subsets of members,
mirroring the template ACL pattern.

## Summary

- Migration adds `group_acl`/`user_acl` JSONB columns (nested `{"<id>":
{"permissions": [...]}}` shape) and seeds every existing config with its
organization's Everyone group read entry (the Everyone group ID equals
the org ID), so member access is unchanged by default. Creation seeds
the same entry.
- The blanket org-member read grant from the base PR is replaced by ACL
evaluation: Rego requires org membership for every ACL grant, and
`GetAuthorizedMCPServerConfigs` compiles ACL-aware SQL filters.
- New `ActionShare` (org admins) gates `GET|PATCH
/api/experimental/organizations/{organization}/mcp-servers/{mcpserverconfig}/acl`
(nested under the organization like the rest of the config surface).
PATCH validates principals against the config's organization, merges
sparse updates under a row lock, stamps `updated_by`/`updated_at`, and
is audited as a Write with `Old` captured before authorization. A config
deleted concurrently between the middleware fetch and the locked
re-fetch is concealed as 404, matching the update and delete handlers.
ACL columns are tracked in the audit table.
- ACL management is available in all editions (no enterprise
entitlement), documented in the MCP servers page. Revoking an ACL does
not retro-strip already-selected configs from existing chats; new
selection is blocked at chat create.
- Force On respects the ACL: the forced set is loaded as the chat owner,
so a `force_on` server whose ACL denies the owner never attaches at
create, send, or generation time.
- No rolling-upgrade machinery: upgrades run in scheduled maintenance
downtime, so the migration only backfills existing rows; the API sets
the Everyone read grant explicitly on every insert.

Stacked on #27943. Part of the MCP org-separation stack.

Closes https://linear.app/codercom/issue/CODAGT-712

UAT: verified on a dogfood instance with two members and a custom group:
Everyone-seed default visibility, group grant with Everyone removal
(non-member loses list/fetch/selection), foreign-principal rejection,
non-admin share denial (audited 403 / concealed 404), user_acl restore,
and audited ACL diffs.

> Mux (AI agent) authored this PR on Mike's behalf.

<!-- mux-attribution: model=claude-fable-5 thinking=high -->
2026-08-19 19:25:18 +00:00

296 lines
8.8 KiB
TypeScript

// Code generated by typegen/main.go. DO NOT EDIT.
import type { RBACAction, RBACResource } from "./typesGenerated";
// RBACResourceActions maps RBAC resources to their possible actions.
// Descriptions are included to document the purpose of each action.
// Source is in 'coderd/rbac/policy/policy.go'.
export const RBACResourceActions: Partial<
Record<RBACResource, Partial<Record<RBACAction, string>>>
> = {
ai_gateway_key: {
create: "create an AI Gateway key",
delete: "delete an AI Gateway key",
read: "read AI Gateway keys",
update: "update an AI Gateway key",
},
ai_model_price: {
read: "read AI model prices",
update: "update AI model prices",
},
ai_provider: {
create: "create an AI provider",
delete: "delete an AI provider",
read: "read AI provider configuration",
update: "update an AI provider",
},
ai_seat: {
create: "record AI seat usage",
read: "read AI seat state",
},
aibridge_interception: {
create: "create aibridge interceptions & related records",
read: "read aibridge interceptions & related records",
update: "update aibridge interceptions & related records",
},
api_key: {
create: "create an api key",
delete: "delete an api key",
read: "read api key details (secrets are not stored)",
update: "update an api key, eg expires",
},
assign_org_role: {
assign: "assign org scoped roles",
create: "create/delete custom roles within an organization",
delete: "delete roles within an organization",
read: "view what roles are assignable within an organization",
unassign: "unassign org scoped roles",
update: "edit custom roles within an organization",
},
assign_role: {
assign: "assign user roles",
read: "view what roles are assignable",
unassign: "unassign user roles",
},
audit_log: {
create: "create new audit log entries",
read: "read audit logs",
},
boundary_log: {
create: "create boundary log records",
delete: "delete boundary logs",
read: "read boundary logs and session metadata",
},
boundary_usage: {
delete: "delete boundary usage statistics",
read: "read boundary usage statistics",
update: "upsert boundary usage statistics",
},
chat: {
create: "create a new chat",
delete: "delete a chat",
read: "read chat messages and metadata",
share: "share a chat with other users or groups",
update: "update chat title or settings",
},
connection_log: {
read: "read connection logs",
update: "upsert connection log entries",
},
crypto_key: {
create: "create crypto keys",
delete: "delete crypto keys",
read: "read crypto keys",
update: "update crypto keys",
},
debug_info: {
read: "access to debug routes",
},
deployment_config: {
read: "read deployment config",
update: "updating health information",
},
deployment_stats: {
read: "read deployment stats",
},
file: {
create: "create a file",
read: "read files",
},
group: {
create: "create a group",
delete: "delete a group",
read: "read groups",
update: "update a group",
},
group_member: {
read: "read group members",
},
idpsync_settings: {
read: "read IdP sync settings",
update: "update IdP sync settings",
},
inbox_notification: {
create: "create inbox notifications",
read: "read inbox notifications",
update: "update inbox notifications",
},
license: {
create: "create a license",
delete: "delete license",
read: "read licenses",
},
mcp_server_config: {
create: "create a new MCP server config",
delete: "delete MCP server config",
read: "read MCP server config",
share: "share MCP server config with other users or groups",
update: "update MCP server config",
},
notification_message: {
create: "create notification messages",
delete: "delete notification messages",
read: "read notification messages",
update: "update notification messages",
},
notification_preference: {
read: "read notification preferences",
update: "update notification preferences",
},
notification_template: {
read: "read notification templates",
update: "update notification templates",
},
oauth2_app: {
create: "make an OAuth2 app",
delete: "delete an OAuth2 app",
read: "read OAuth2 apps",
update: "update the properties of the OAuth2 app",
},
oauth2_app_code_token: {
create: "create an OAuth2 app code token",
delete: "delete an OAuth2 app code token",
read: "read an OAuth2 app code token",
},
oauth2_app_secret: {
create: "create an OAuth2 app secret",
delete: "delete an OAuth2 app secret",
read: "read an OAuth2 app secret",
update: "update an OAuth2 app secret",
},
organization: {
create: "create an organization",
delete: "delete an organization",
read: "read organizations",
update: "update an organization",
},
organization_member: {
create: "create an organization member",
delete: "delete member",
read: "read member",
update: "update an organization member",
},
prebuilt_workspace: {
delete: "delete prebuilt workspace",
update: "update prebuilt workspace settings",
},
provisioner_daemon: {
create: "create a provisioner daemon/key",
delete: "delete a provisioner daemon/key",
read: "read provisioner daemon",
update: "update a provisioner daemon",
},
provisioner_jobs: {
create: "create provisioner jobs",
read: "read provisioner jobs",
update: "update provisioner jobs",
},
replicas: {
read: "read replicas",
},
system: {
create: "create system resources",
delete: "delete system resources",
read: "view system resources",
update: "update system resources",
},
tailnet_coordinator: {
create: "create a Tailnet coordinator",
delete: "delete a Tailnet coordinator",
read: "view info about a Tailnet coordinator",
update: "update a Tailnet coordinator",
},
task: {
create: "create a new task",
delete: "delete task",
read: "read task data or output to view on the UI or CLI",
update: "edit task settings or send input to an existing task",
},
template: {
create: "create a template",
delete: "delete a template",
read: "read template",
update: "update a template",
use: "use the template to initially create a workspace, then workspace lifecycle permissions take over",
view_insights: "view insights",
},
usage_event: {
create: "create a usage event",
read: "read usage events",
update: "update usage events",
},
user: {
create: "create a new user",
delete: "delete an existing user",
read: "read user data",
read_personal: "read personal user data like user settings and auth links",
update: "update an existing user",
update_personal: "update personal data",
},
user_secret: {
create: "create a user secret",
delete: "delete a user secret",
read: "read user secret metadata and value",
update: "update user secret metadata and value",
},
user_skill: {
create: "create a user skill",
delete: "delete a user skill",
read: "read user skill metadata and content",
update: "update user skill metadata and content",
},
webpush_subscription: {
create: "create webpush subscriptions",
delete: "delete webpush subscriptions",
read: "read webpush subscriptions",
},
workspace: {
application_connect: "connect to workspace apps via browser",
create: "create a new workspace",
create_agent: "create a new workspace agent",
delete: "delete workspace",
delete_agent: "delete an existing workspace agent",
read: "read workspace data to view on the UI",
share: "share a workspace with other users or groups",
ssh: "ssh into a given workspace",
start: "allows starting a workspace",
stop: "allows stopping a workspace",
update: "edit workspace settings (scheduling, permissions, parameters)",
update_agent: "update an existing workspace agent",
},
workspace_agent_devcontainers: {
create: "create workspace agent devcontainers",
},
workspace_agent_resource_monitor: {
create: "create workspace agent resource monitor",
read: "read workspace agent resource monitor",
update: "update workspace agent resource monitor",
},
workspace_build_orchestration: {
create: "create a workspace build orchestration",
delete: "delete a workspace build orchestration",
read: "read a workspace build orchestration",
update: "update a workspace build orchestration",
},
workspace_dormant: {
application_connect: "connect to workspace apps via browser",
create: "create a new workspace",
create_agent: "create a new workspace agent",
delete: "delete workspace",
delete_agent: "delete an existing workspace agent",
read: "read workspace data to view on the UI",
share: "share a workspace with other users or groups",
ssh: "ssh into a given workspace",
start: "allows starting a workspace",
stop: "allows stopping a workspace",
update: "edit workspace settings (scheduling, permissions, parameters)",
update_agent: "update an existing workspace agent",
},
workspace_proxy: {
create: "create a workspace proxy",
delete: "delete a workspace proxy",
read: "read and use a workspace proxy",
update: "update a workspace proxy",
},
};