Skip to content
Drydock
ConfigurationAuthentication

Roles

Give each signed-in user a viewer, operator or admin role, and see exactly which API routes each role reaches.

Pre-release docs

These docs cover v1.9, a release candidate that isn't generally available yet. Running the stable release? Read the docs for v1.7.

Every person who signs in holds one of three roles. The server enforces it on every API route, whatever client sent the request.

RoleCan
viewerRead everything: containers, logs, stats, approvals, the audit log, registries, triggers, settings. Save their own UI preferences and manage their own two-factor setup.
operatorEverything a viewer can, plus watch and scan, update and roll back, start, stop and restart, approve, reject and defer queued updates, cancel operations, fire triggers and retry queued notifications.
adminEverything, including settings, configuration, label overrides, group policies, notification rules and silences, image prune and cleanup, container deletion, the environment reveal, the debug dump, agent keys and API keys.
Nothing changes until you set a role. A user with no role configured is admin, which is what every signed-in user was before roles existed.

Setting a role

Basic users

Add DD_AUTH_BASIC_{auth_name}_ROLE next to the user's _USER and _HASH. Values are admin, operator and viewer, matched without regard to case.

environment:
  - DD_AUTH_BASIC_SCOTT_USER=scott
  - "DD_AUTH_BASIC_SCOTT_HASH=argon2id$$65536$$3$$4$$..."
  - DD_AUTH_BASIC_OPS_USER=ops
  - "DD_AUTH_BASIC_OPS_HASH=argon2id$$65536$$3$$4$$..."
  - DD_AUTH_BASIC_OPS_ROLE=operator
  - DD_AUTH_BASIC_WALLBOARD_USER=wallboard
  - "DD_AUTH_BASIC_WALLBOARD_HASH=argon2id$$65536$$3$$4$$..."
  - DD_AUTH_BASIC_WALLBOARD_ROLE=viewer

Here scott has no role set, so he's admin.

Anonymous access

With DD_ANONYMOUS_AUTH_CONFIRM=true, set DD_ANONYMOUS_AUTH_ROLE to choose what an anonymous visitor holds. Unset is admin, as before. viewer gives you a read-only dashboard.

environment:
  - DD_ANONYMOUS_AUTH_CONFIRM=true
  - DD_ANONYMOUS_AUTH_ROLE=viewer

OIDC users

OIDC users are admin until you map groups. Set DD_AUTH_OIDC_{auth_name}_ADMINGROUP, _OPERATORGROUP and _VIEWERGROUP to the group names in your IdP's groups claim, and _DEFAULTROLE for everyone else. The highest matching role wins.

environment:
  - DD_AUTH_OIDC_KEYCLOAK_ADMINGROUP=drydock-admins
  - DD_AUTH_OIDC_KEYCLOAK_OPERATORGROUP=drydock-ops
  - DD_AUTH_OIDC_KEYCLOAK_VIEWERGROUP=drydock-viewers
  - DD_AUTH_OIDC_KEYCLOAK_DEFAULTROLE=viewer

DEFAULTROLE is admin, operator, viewer or none; none refuses the login of anyone who matches no group. The full rules are on the OIDC page.

Database users

Users created in Settings > Users hold a role you pick when you create them, and an admin can change it later. See Managing users.

API keys

API keys don't have a role. A key's scopes are its authority, and only an admin can create one.

Managing users

Admins manage sign-in accounts in Settings > Users. The tab lists every account that can sign in with a username and password, and only an admin sees it. Operators and viewers don't get the tab, and the API refuses them too.

There are two kinds of user:

  • Environment users come from DD_AUTH_BASIC_* variables. They show up with an Environment badge and are read-only in the UI. Change them in your Compose file, then run docker compose up -d drydock.
  • Database users are created in the UI (or the users API) and stored in Drydock. Admins can create them, change their role, disable or enable them, reset their password and delete them. Disabling, a password reset and deleting end that user's open sessions.

A username is 1 to 64 characters from letters, digits and . _ @ -. A password is 12 to 1024 characters and can't contain a colon, because the Basic header can't carry one. If an environment user has the same name as a database user, the environment user wins and the database account is marked Shadowed.

Two guards stop an admin from locking the instance out:

  • You can't change your own account. Disabling, demoting or deleting the account you're signed in with is refused.
  • The last admin stays. A change that would leave nothing granting admin (no enabled database admin, no Basic admin, no OIDC or anonymous admin) is refused.

Managing users needs a signed-in session. API keys, anonymous access and a session that signed in with a recovery code are refused, so a key can't mint a login that outlives it. The full route list is in the users API reference.

How it's checked

  • Basic and database roles are read on every request. An environment (Basic) user's role comes from the configuration the server is running with. In Compose, apply a change with docker compose up -d drydock. For database users, a change in Settings > Users applies on their next request.
  • A role miss is a 403 with {"error": "Role does not permit this action", "details": {"requiredScope": "containers:update", "requiredRole": "operator"}}. Routes that have no scope (the session-only ones) name only requiredRole.
  • A bad role stops that user from signing in. An invalid DD_AUTH_BASIC_{auth_name}_ROLE fails that user's registration, an invalid DD_AUTH_OIDC_{auth_name}_DEFAULTROLE fails that OIDC provider's registration, and an invalid DD_ANONYMOUS_AUTH_ROLE turns anonymous access off. Drydock never guesses a role from a typo.
  • Startup checks admin access when an authentication provider declares a role. Drydock then needs a provider that grants admin or an enabled database admin who can sign in. With only database users configured, Drydock can start even if none is an admin. If you removed the last admin provider, restore it and restart Drydock to manage users again.
  • An OIDC role is stored in the session at login. It's worked out again every time the person signs in. OIDC sessions from before a group mapping was set are signed out.
  • A session from a removed account loses admin. Once any role is configured, a session whose account no longer exists is held to viewer.
  • Startup logs the roles. One line lists each authentication and its role. With two or more Basic users and no role set on any of them, a second line points out that they're all admin.

The OpenAPI document (GET /api/v1/openapi.json) marks every operation with x-drydock-min-role, the least role it needs, next to x-drydock-scope.

Audit trail

  • Every audit row records the role. When a person causes an entry, actorRole is stored next to the actor, so the log still says what authority acted after you change someone's role. API keys have no role and leave it empty. The audit export includes an actorRole column.
  • A refusal is audited. A request refused for lack of a role or scope writes an auth-denied entry naming the actor, their role, the route, the scope and the role it needed. The same actor refused on the same route again within a minute doesn't write a second row, so someone probing every admin route can't fill the log.
  • A refusal is counted. drydock_authz_denied_total{scope,role} goes up on every refusal, throttled or not. See monitoring.

What the UI shows

The UI hides what your role can't do, so a viewer sees no update, rollback, scan, snooze, approve or reject buttons, and no Settings entry in the sidebar. An operator keeps those but doesn't see Settings. Your role is shown in the user menu. Profile and appearance stay open to everyone.

This is a convenience, not the check. The server still refuses a request your role can't make, and the UI shows a "Not allowed" toast when that happens. GET /auth/user returns your role and scopes for the UI to read. An API key gets scopes and no role.

Route matrix

A route's role comes from the scope it declares: read needs viewer, containers:watch, containers:update, containers:control and triggers:test need operator, and admin and api-keys:manage need admin. A few routes set their own, and those are noted below. The test suite pins every registered route to a minimum role (app/api/rbac-matrix.test.ts), and this table is maintained from that list.

RoutesScopeLeast role
Every GET route not listed below: containers, logs, stats, SBOMs (an API key with only read gets a stored one; generating a missing one needs containers:watch), vulnerabilities, release notes, backups, approvals, audit log and export, registries, triggers, watchers, agents, settings, notifications, the outbox list, metrics, eventsreadviewer
GET and PATCH /preferences (your own UI preferences)session-only: an API key gets 403 at any scopeviewer
Two-factor enrollment, removal and recovery codes under /auth/totp-*session-onlyviewer
POST /containers/watch, /containers/:id/watch, /containers/scan-all, /containers/:id/scan, /containers/:id/preview, /containers/:id/update-chain-preview, /watchers/.../inventorycontainers:watchoperator
POST /containers/update, /containers/:id/update, /containers/:id/rollback, /dependency-groups/:rootId/update, /operations/:id/cancel, PATCH /containers/:id/update-policy, approve, reject, defer and bulk-decide approvalscontainers:updateoperator
POST /containers/:id/start, /stop, /restartcontainers:controloperator
POST /notifications/:id/preview, POST /notifications/outbox/:id/retry (an entry for an action or CI rebuild provider, or a trigger that is no longer registered, also needs containers:update)triggers:testoperator
Running a trigger (/containers/:id/triggers/..., /actions/..., /notification-triggers/..., /triggers/...)containers:update for an action and for the CI rebuild providers githubdispatch and gitlabpipeline, triggers:test for any other notificationoperator
PATCH/PUT /settings, config edits, validate and reload, label overrides and group policy writes, notification rule edits, silences, DELETE /notifications/outbox/:id (discard a failed delivery), DELETE /containers/:id, image prune and prune preview, cleanup run, icon cache clear, scanner asset management, self-update acknowledgementadminadmin
GET /config and its sections and editors, POST /containers/:id/env/reveal, GET /debug/dump, agent key rotation, agent audience pins, Portwing keys and enrollment codes, the users API (GET and POST /users, PATCH and DELETE /users/:id)session-onlyadmin
API key list, create and revokeapi-keys:manageadmin
Webhooks (/webhook/..., /webhooks/registry/...), the self-update status poll and finalize callbacksession-onlynone: these check their own credential

What a role doesn't cover

An admin is host-equivalent: they can configure a command action and reach the Docker socket through it, so only give it to people you'd give the host to. An operator can update and restart every watched container on every host, agents included. Use approvals to put a person in front of updates if that matters. Roles don't isolate tenants or environments from each other, and they don't protect against a compromised reverse proxy or identity provider.