MANAGE ACCESS GRANTS
This guide shows you how to control what authenticated users can do on a
swamp serve instance using authorization grants.
Create an allow grant
Grant a user permission to run all behaviors:
swamp access grant create --subject user:sarah --allow run --on 'behavior:*' \
--server wss://swamp.example.comThe server stores a behavior: selector as model:, so listings show
model:*.
swamp access policy create is an alias for swamp access grant create — they
do the same thing.
Create a deny grant
Deny grants override allow grants. To block a user from reading specific data:
swamp access grant create --subject user:adam --deny read \
--on 'data:@acme/secrets-*' --server wss://swamp.example.comAdd a CEL condition
Restrict a grant to specific contexts using --when:
swamp access grant create --subject user:sarah --allow run \
--on 'workflow:@acme/*' --when 'tags.env == "staging"' \
--server wss://swamp.example.comThe condition is evaluated against resource fields at access-check time. See the CEL Expressions reference for the full syntax.
Reload the policy snapshot
Grants are staged until you reload. This is the safety mechanism — a bad policy does not take effect until deliberately applied:
swamp access reload --server wss://swamp.example.comIf you want grants to take effect immediately without a manual reload, start the
server with --grant-reload auto:
swamp serve --auth-mode token --admins 'user:paul' --grant-reload autoswamp access reload applies the staged changes on the instance it reaches. You
do not need to reload every peer: other serve instances on the same S3, GCS or
v2 filesystem datastore pick up a grant, revoke or group change within one
--datastore-poll-interval (default 30s), in either reload mode. See
Multiple instances.
List grants
swamp access grant list --server wss://swamp.example.comRevoke a grant
swamp access grant revoke <grant-id> --server wss://swamp.example.comAfter revoking, reload the policy snapshot for the change to take effect (unless
using --grant-reload auto).
Check access for a specific user
Admins can check whether a subject is allowed to perform an action:
swamp access check --subject user:sarah --action run \
--on 'behavior:hello' --server wss://swamp.example.comTo simulate IdP group memberships for idp-group: grants, run the check locally
against the repository's grants with --groups:
swamp access check --subject user:adam --action run \
--on 'workflow:@acme/deploy' --groups platform-eng,opsTo test condition evaluation against resource fields, also run the check locally:
swamp access check --subject user:adam --action run \
--on 'workflow:@acme/deploy' --field tags.env=stagingA check against a server refuses --groups, --collectives and --field: the
server evaluates conditions against its own resource context, and knows IdP
groups and collectives only for your own session, so checking another subject
there does not reflect its idp-group: grants.
Admin grants from config
The --admins flag materializes admin grants at startup. Admins receive admin
on access:*, which implies all actions on all resources.
To add an admin: add the principal to --admins and restart the server. To
remove an admin: remove the principal from --admins and restart. The config is
reconciled on every boot — config is the source of truth.
Related
- Manage Grants with Files — manage grants as YAML files checked into version control
- Limit Which Vaults a Run Can Use — scope the vaults a principal's serve runs can read and write
- Authorization — full reference for subjects, effects, actions, resource selectors, and deny-wins semantics
- Check Your Permissions — how users check their own access
- Real-World Scenarios — team isolation, deny overrides, and more