Authentication vs. authorization
A token only proves identity. What that identity is allowed to do is decided separately, by role bindings. This separation is the single most important security property to understand: A token is exactly as dangerous as the roles bound to its owner. A leaked token bound only to a Viewer role can read; a leaked token bound to an Admin role can do real damage. To restrict what a token can do, change the role binding - not the token. This is why least privilege matters so much.Storing tokens safely
- Never commit a token to source control. Treat any token that lands in a repo, log, chat message, PR comment, or screenshot as compromised - revoke it.
- Never hardcode tokens in source or config files. Use environment variables or a secrets manager.
- Personal access tokens → store in a personal password manager (1Password, Bitwarden).
- Service account API keys → store in your platform’s secrets store (GitHub Actions Secrets, AWS Secrets Manager, HashiCorp Vault, and so on).
Least privilege
- Assign the minimum role required. A pipeline that only reads data should be bound to a Viewer role, not Admin. Token permissions come entirely from role bindings, so the role binding is the security boundary.
- One key per application. Never share a single token across multiple apps or teams - separate keys mean you can revoke one without breaking the others, and the audit trail stays meaningful.
- Never use a PAT in CI/CD. A PAT carries your personal roles and will outlive your access if you change teams or leave. Use a service account with its own scoped role binding.
- One service account per system. A dedicated account for CI, another for Airflow, another for monitoring - each with only the access it needs.
Expiry and rotation
- Set an expiry on every token unless you have a deliberate rotation process. Expiry is enforced on every request; an expired token returns
401. - Rotate proactively - before expiry and immediately on suspected exposure - using create-before-delete to avoid downtime. See Create, use, rotate, and revoke tokens.
- Review active tokens periodically and revoke any that are no longer in use.
Revocation and offboarding
Revocation takes effect immediately - a revoked token fails on its very next request.- Exposed token? Revoke it at once (Console or API), then issue a replacement.
- Service account deleted? All of its API keys are invalidated immediately - there is no grace period. Stand up a replacement account and rotate the credentials in your applications before deleting the old one.
- Team member leaving? This is the one most people get wrong:
Admin controls
Workspace admins can manage tokens across all users - but note this is done through the API, not the Console. The User settings → Access tokens screen only shows your own tokens; there is no cross-user view in the UI. Admin token operations are gated by role permissions:
Revoke every token for a departing team member:
serviceaccounts:create, :read, :update (covers adding and revoking keys), and :delete. Grant these only to admins who manage automation identities.
Incident response - a leaked token
- Revoke the exposed token immediately (Console, or
DELETE …/tokens/<uuid>). For a whole user, revoke all their tokens viaDELETE …/users/<email>. - Rotate anything that shared the same secret store or pipeline.
- For suspected usage abuse, pull your gateway or access logs.
- Re-issue replacements with an expiry and the minimum role binding.
Security checklist
See also
- Access tokens - the canonical token-types table.
- Create, use, rotate, and revoke tokens - creating, using, and rotating tokens.
- Roles and permissions - defining the role bindings that bound a token’s access.