Access control

From controlplane-com/ai-plugin · View interactive version

Access control is an AI agent skill from the GitHub repository controlplane-com/ai-plugin. Primary skill for access control, policies, and RBAC on Control Plane. Use when the user asks about permissions, policies, service accounts, user access, group membership, bindings, who can do what, least-privilege, or IAM.

How to use this skill

Skill file

Access Control & Policies — Primary Skill

Tool availability: get_permissions, create_group, edit_group, create_service_account, update_service_account, add_key_to_service_account, and invite_user_to_org need ?toolsets=full; reconnect with it or use the CLI. On core, grant_workload_secret_access (remove: true revokes) grants a workload secret access through its identity and a policy, creating either when missing; grant_cloud_access creates no policy: it makes sure the workload has an identity and sets that identity's cloud provider access.

A policy targets one resource kind and binds permissions to principals (users, groups, service accounts, workload identities). The common failure is a policy that exists but grants nothing — a wrong targetKind, permission name, or principal link fails with no error — so read the policy back after writing.

The model

| Layer | Scope | Controls |

|---|---|---|

| Billing-account roles | account-wide (set on the billing account, separate from org policies) | billing_admin, billing_viewer, org_creator — none grant org-resource access |

| Org policies | per resource kind | all day-to-day access |

A caller is allowed an action when some policy on the resource's kind has a binding that lists that action (or a permission implying it) and names the caller — or a group the caller is in.

Policy anatomy

A policy = one targetKind + a target scope + bindings.

kind: policy
name: app-secret-access
targetKind: secret           # exactly one resource kind
targetLinks:                 # OR `target: all` OR `targetQuery:` (pick one)
  - //secret/database-url
bindings:                    # ≤ 50
  - permissions: [reveal, use]
    principalLinks:          # 1–200
      - //gvc/production/identity/app-identity

Limits: bindings ≤ 50; principalLinks 1–200 per binding; targetLinks ≤ 200. origin is read-only — default (yours) or builtin (locked; see Built-ins).

Target scope (pick one): target: all (org-wide roles) · targetLinks (specific resources) · targetQuery (tag query — see query-spec).

Valid target kinds: the targetKind enum accepts all 33 resource kinds, but only the 20 kinds with permission schemas (the ones get_permissions accepts) are meaningful targets: workload, secret, gvc, identity, image, org, policy, group, serviceaccount, user, volumeset, domain, location, ipset, mk8s, cloudaccount, agent, auditctx, quota, task.

Create vs update:

Permissions

get_permissions (kind) is the source of truth — it returns the kind's exact permission list and its implication map. Confirm names with it before writing a policy; never hand-write them, and don't assume a kind only has create / delete / edit / view / manage.

Two traps that don't need a lookup:

Many kinds add non-obvious permissions beyond CRUD — e.g. secret reveal/use, image pull, workload connect/exec.*, serviceaccount addKey, user invite/impersonate, mk8s clusterAdmin — so pull the real set with get_permissions.

Principals

| Type | Link |

|---|---|

| User | //user/EMAIL |

| Group (preferred) | //group/NAME |

| Service account | //serviceaccount/NAME |

| Workload identity | //gvc/GVC/identity/NAME (GVC-scoped — never //identity/NAME) |

An identity never belongs to a group, so authorize it only with a binding that names its exact link. At runtime the attached identity is the workload's API credential: calls from inside the workload with the injected CPLN_TOKEN against CPLN_ENDPOINT carry exactly the permissions policies grant that identity — nothing more.

Groups

Members are users and service accounts only (≤ 200). Bind policies to groups, not individuals.

Service accounts (non-human / CI/CD)

Users (IDP-backed)

Built-ins (seeded per org)

| Resource | Name | Grants |

|---|---|---|

| Group | superusers | manage on every kind (creator auto-added) |

| Group | viewers | view on every kind |

| Service account | controlplane | platform-internal — off-limits |

| Policies | superusers-KIND / viewers-KIND | origin: builtin, target: all |

Common RBAC patterns

create_policy builds these; the cpln apply -f manifest is the policy-as-code equivalent for CI/CD.

Standard flow

  1. Confirm the org (and gvc for identities); never guess.
  2. get_permissions for the kind: confirm permission names.
  3. Read current state: list_resources (kind="policy") / get_resource (kind="policy") (+ get_resource kind="group" / kind="serviceaccount").
  4. Smallest change; if destructive, confirm blast radius.
  5. create_policy / update_policy (+ group / SA / user tools).
  6. Verify: read the policy back; confirm the bindings and target resolved.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.