Scopes and levels
branchd's feature scopes, what each one allows, and the read, write, maintain and admin levels that bundle them.
A scope names one feature at one level. The verbs are read, edit
and admin, and each implies the ones before it: admin ⊃ edit ⊃
read. Ask for, or issue, only the scopes the job needs. A key that can
pull images cannot clone, and a token that can clone cannot push.
The same scopes are checked everywhere: the API, git over HTTPS, the container registry, Go modules and release downloads.
Feature scopes
| Scope | Allows |
|---|---|
forge:contents:read | Clone and fetch, read files, commits and blame, compare, fetch Go modules |
forge:contents:edit | Push, and create or delete branches and tags |
forge:repository:read | Read repositories and their settings |
forge:repository:edit | Change repository settings |
forge:repository:admin | Create, delete, rename and transfer repositories; visibility, access and grants, webhooks and mirrors |
forge:group:read | See groups and their settings |
forge:group:edit | Create and change groups, their labels and settings |
forge:group:admin | A group's access, bots and runner pools |
forge:pull-request:read | Read pull requests and their comments |
forge:pull-request:edit | Open, edit, close and comment on pull requests |
forge:pull-request:merge | Merge pull requests, where branch rules allow |
forge:review:read | Read reviews |
forge:review:edit | Review and approve pull requests |
forge:check:read | Read checks on commits |
forge:check:edit | Report checks on commits. A check reported this way never counts as a required check. |
forge:branch-rule:read | Read branch rules |
forge:branch-rule:edit | Change branch rules |
forge:release:read | Read releases and download their assets |
forge:release:edit | Create, edit and publish releases |
forge:package:read | Pull container images, and see tags and retention |
forge:package:edit | Push container images |
forge:package:admin | Set and apply retention, and delete images. Deleting also needs a key at the maintain level (it must hold forge:branch-rule:edit). |
forge:pipeline:read | Read runs, logs and drafts |
forge:pipeline:edit | Run, retry and cancel pipelines, fire schedules, edit drafts |
forge:pipeline:admin | Change pipeline settings, variables and secrets |
Webhooks and mirrors are under forge:repository:admin because both hold
or send secrets.
Some scopes are never put on a key: your SSH keys (forge:ssh-key:*),
session credentials and your profile. A key can never manage keys, SSH
keys, session credentials, bots or access grants, whatever scopes it has.
Levels
A level is a named bundle of scopes, offered by the console and by the
CLI's --level as a shortcut. Each level contains the one before it.
| Level | Adds |
|---|---|
| read | Every feature's :read: group, repository, contents, pull-request, review, check, branch-rule, release, package, pipeline |
| write | contents:edit, pull-request:edit, review:edit, check:edit, release:edit, package:edit, pipeline:edit |
| maintain | pull-request:merge, branch-rule:edit, repository:edit, pipeline:admin |
| admin | repository:admin, group:edit, group:admin, package:admin |
A key below the maintain level stays at write access even where your role is higher. It cannot create or force-update protected branches or tags, or delete images.
Choosing scopes: examples
| Job | Scopes |
|---|---|
| Clone repositories in CI | forge:contents:read |
| Pull images from the registry | forge:package:read |
| Push images | forge:package:edit |
| Publish releases from a build | forge:release:edit, forge:contents:read |
| Report a status check from an external system | forge:check:edit |
| A review bot that comments on pull requests | forge:pull-request:edit, forge:contents:read |