Access tokens with a time limit#
A script that calls the server needs a credential. Giving it an administrator's password gives it everything, for ever. An access token gives it a slice: these permissions, on these users or jobs, for this long. When the time is over, or the slice is no longer needed, the token is worth nothing.
Tokens are made for scripts, for integrations, and for AI tools that act for a person.
What a token is#
| Part | What it is |
|---|---|
| the secret | a long random text of the form cft_<id>.<secret>. It is shown once, when the token is made. The server keeps only a hash of it: nobody can read a token out of the server later. |
| the issuer | the person who made it. The token acts for them. |
| grants | the permissions it carries, each with the users, jobs or storage it holds for. Always a subset of what the issuer has. |
| lifetime | how long it is good. One hour unless the issuer chooses otherwise, up to no end. |
| limits | optionally: a number of uses, an idle time after which it dies, the addresses it may come from |
| read-only | it can read and never change anything |
| propose mode | its changes are not made. Each becomes a proposal that the issuer approves or rejects. |
| for files | optionally: the folders, the file permissions and the protocols it may use |
| a label | which tool, for what. It is in the audit log with every use: "agent X for alice". |
The rules#
- Never more than its issuer. What a token may do is worked out at every single use: its own grants, cut down to what the issuer may do at that moment. An issuer who is demoted, disabled or deleted takes their tokens with them.
- Never tier 0. A token cannot do what equals full control of the server: change access settings, restore the preferences, run programs. Those need a person's own login. See Roles and access.
- Never hand itself on. A token cannot make tokens, change its issuer's password, or read the audit log.
- Revoked at once. A token is looked up on every use; a revoked one is refused on the next request.
Making one#
In the User Manager: open your own account, tab Admin, part Access, card Access tokens. See Giving a user roles.
With the API: POST /tokens, with the grants and limits. The answer holds the token; it is in that answer and nowhere else, ever. GET /tokens lists your tokens, DELETE /tokens/{id} revokes one. See Credentials.
Copy the secret into the tool's own secret store at once. If it is lost, revoke the token and make another.
Using one#
The tool sends it with every request, in a header:
Authorization: Bearer cft_ab12cd34.9f8e7d6c…
Two calls help a tool to find its way:
| Call | Answers |
|---|---|
GET /whoami |
who the token acts for, what it may do, and its limits |
POST /explain |
"may I do X to Y?", with the reason when not |
A request the token may not make is answered with 403 and the name of the permission that is missing.
Choosing the limits#
| The token is for | Give it |
|---|---|
| a nightly script that reads a report | read-only; the one permission; the address of the machine it runs on; a lifetime of months, with a date in your calendar |
| a one-off migration | exactly the permissions of the job; a lifetime of a day |
| an AI assistant that helps a person look things up | read-only; an hour |
| an AI assistant that shall change things | propose mode, so that a person approves each change |
| a partner's integration | the narrowest grants; their addresses; and a person on your side who owns it |
The pages warn when a lifetime is longer than 30 days or has no end. A token without an end still ends when its issuer does, and can be revoked.
An administrator can set a ceiling for the whole server on what tokens may carry and how long they may live.
Why propose mode#
A tool that reads text can be steered by text: a file name, a note on a user, a line in a log that says "now delete everything". A token in propose mode cannot be talked into damage. Whatever it tries to change is stored as a proposal, with the old and the new values side by side, and the issuer decides.
Keeping track#
- Every issue, use and revocation of a token is in the access audit log, which the role Auditor may read.
- The card Access tokens on each account lists that account's tokens. An account with the right to see all tokens sees everybody's.
- Review the list regularly. Revoke what has no owner, no label you understand, or no end.
Not to be confused with#
| Is | |
|---|---|
the c2f token |
protects browser sessions against forged requests: Protection against cross-site requests |
| a share's link | the login of a share: Temp accounts |
| an OAuth token | what the server uses to sign in to other systems: Special types |