Permissions
Decide who reads, publishes and administers: project roles and permission policies for content, visibility levels for readers, system roles for administration.
On this page
The model
- Deny by default. A fresh installation has no project and no policy, and everything is Private: only an administrator reads.
- Allow only. Roles, policies and visibility levels only add rights. Only an exclude pattern of the same policy, a token's scope and an endpoint's exposure rules narrow them.
- No action implies another.
deploydoes not includeread. - Content and administration are apart. Roles and policies decide repository actions; system roles and a project's Owner decide
administration. The
adminrole is the one bridge: it passes every repository action too.
How a request is decided
A virtual repository needs read on itself; its content is then decided on the member that serves it, a write on its deployment
target. After a grant come checks that never grant: a remote cache is filled only with the repository's cache-fill action, and a
package name with an owner is changed only by its owners and manage holders
(Repositories).
| Refused | Answer |
|---|---|
| By the endpoint's exposure rules | 404, for every caller (Endpoints) |
| Without a credential | 401, for a read and a write alike |
| A read | 404, as for a repository that does not exist |
| A write or an administration | 403, naming the action |
authz.hide_existence: false, or Hide existence from callers without access per repository, answers 403 for a refused read
instead, for troubleshooting (authz).
Every replica decides from a copy of all policies, memberships and role bindings in memory. Another replica applies a change within
about a second; one that cannot confirm its copy for authz.cache.max_staleness answers 503 authz_stale.
Principals
| Principal | Reference | Who |
|---|---|---|
| User | user:alice |
A person, or the break-glass account |
| Group | group:web-devs |
Every member at the moment of the request |
| Service account | sa:partner, sa:web/partner |
The account and its tokens; the second belongs to project web |
| CI mapping | ci:gitlab-main/release, ci:gitlab-main/web/release |
The CI tokens the mapping contributed to (GitLab CI federation) |
Groups and memberships are looked up per request, so a change needs no new token. A policy cannot name anonymous or
authenticated (principal_not_allowed); a renamed user keeps its rights.
Resources
A global policy names repositories with their project; a project policy names its project's repositories by bare key.
| Selector | Global policy | Project policy | Covers |
|---|---|---|---|
| Key | web/npm-internal |
npm-internal |
That repository |
| Pattern | web/npm-team-*, */npm-* |
npm-team-* |
Matching repositories, also later ones |
| Class | @any-local, @any-remote, @any-virtual, @any |
the same | Every repository of the class, in every project or in the project |
| Format | web/npm-*:npm, @any-local:npm |
npm-*:npm |
A pattern or class of one format |
* and ? never cross the /. Package names and Paths each take Include and Exclude patterns; an empty include list
is unrestricted, an exclude always wins. In package names ** also crosses /.
| Format | Narrow it by |
|---|---|
| npm, NuGet | Package names (@web/*, acme.core*): a path pattern admits a file but not the package's metadata, and the editor warns |
| OCI | Image names (team/*, or team/** with nested names), which cover every tag and layer |
| Debian | Binary package names cover the package files only; an APT source needs read without patterns, for the indexes |
Actions
| Action | Allows |
|---|---|
read |
Download, list, read metadata; fill a remote's cache where its cache-fill action is read; use a virtual repository |
annotate |
Reserved: no operation requires it |
deploy |
Publish new files and versions, change npm dist-tags |
overwrite |
With deploy, replace a file with other bytes or move an OCI tag; npm versions and Debian files never |
delete |
Delete files, versions and packages; evict a remote's cache |
manage |
Package owners, namespace claims, a first version that shadows a remote member, cache invalidation, Debian signing keys |
The Preset expands on save: read, write (read, annotate, deploy), maintain (adds overwrite, delete),
full (adds manage). Repository configuration needs repositories:write-config, never an action.
Visibility levels
A project has one level; a repository one for its artifacts and one for its wiki (README and package documentation).
| Level | Reads besides members and the principals a policy names |
|---|---|
| Private | Nobody |
| Internal | Every signed-in person and every token, also of service accounts and CI jobs, but external users |
| Public | Every request, also without a credential, where the endpoint admits that |
- Never more open than the container: artifacts at most as open as the project, the wiki at most as the artifacts.
- An administrator sets a project's level; its Owner or a holder of
repositories:write-configa repository's. A level never allows a write. - Public needs
auth.anonymous: trueon the default endpoint (409 public_not_allowedotherwise). - A public remote repository lets anyone fill its cache from the upstream;
cacheFillAction: deploycloses that. - External users: Sign-in and identities.
Restrict who opens content
- Who
- administrators (
security-settings:write)
- Admin area › Settings › General, section Visibility.
- Under Restricted visibility levels, tick Public: only administrators can then choose it.
- Save changes. Public now lists what stays public until you lower it.
Default project visibility sits in the same section; it cannot be a restricted level.
System roles
Fixed roles, bound to users, groups and service accounts of no project on Admin area › Access › System roles (Bind to,
Unbind, roles:write). A token exercises them only with the administrator scope or listed capabilities.
| Role | Holds |
|---|---|
admin |
Every capability, also content:bypass (every repository action) and projects:write |
security-admin |
Changes identities, policies, CI issuers and mappings, endpoints and security settings; reads and revokes tokens; reads roles, configuration, projects, settings, audit log, download limits and usage; triage |
auditor |
Reads everything not secret, also every repository's metadata (content:metadata-read), the audit log, limits and usage; triage; downloads and changes nothing |
repository-admin |
Every repository's configuration of every project, also move; projects and endpoints: read |
webhook-admin |
Reserved |
vulnerabilities:triage changes findings and so sets or lifts download blocks. The last administrator stays bound while the
break-glass account is disabled (last_admin). A binding from the Helm values shows Helm configuration and no Unbind
(Administrators from the Helm values).
Write a policy
- Who
- holders of
policies:write; Owners for their project's policies
- New policy in a project's Permission policies writes a project policy; in Admin area › Access › Permission policies a global one, marked Global policy — applies to every repository.
- General: a Name (fixed) and a Description.
- Principals and actions: Add principal, type part of a name, choose the match, tick actions or a Preset.
- Repositories and patterns: the Repository selectors; Limit to package names or paths with its Pattern tester.
- Check the Preview, then Create policy; a change ends with Review and save.
Try it in the preview answers whether a principal may do an action on a repository under this draft alone, step by step.
Typical setups
A team works in its project
An administrator creates project web with First Owners; an Owner adds group team-web as Developer: its members read and
publish in every repository of web without a policy.
A CI service account of a project
For GitLab CI, prefer GitLab CI federation. Otherwise an Owner of web creates sa:web/ci, a project policy giving
it read and deploy on npm-internal with package include @web/*, and read on what it installs from. Its token's scope names
web/npm-internal with those actions, so a leaked token reads no Internal repository elsewhere.