Identity and audit
Use this page to look up the audit entry, the export formats, the identity variables and the
AgentFlowEngine fields.
The caller
Every command has a caller. The server decides who it is from the Authorization header.
Caller kind | Credential | Administrator |
|---|---|---|
local | the bootstrap token AFE_API_TOKEN. | yes |
service_account | a token starting with afe_sa_. | never |
person | an OpenID Connect token, or a browser session. | when a group is in AFE_OIDC_ADMIN_GROUPS |
system | none: the engine itself. | — |
The audit entry
The engine appends one entry for every command. A refusal leaves one only on
service_account.create and service_account.revoke. Reads write nothing.
| Field | Meaning |
|---|---|
seq | Increasing number the store assigns. |
at | When the action happened, as an ISO 8601 instant. |
actor | The caller: kind, id, name, groups (at most the first 50). |
action | ticket.start, ticket.rerun, ticket.resume, ticket.pause, ticket.cancel, ticket.clean, service_account.create, service_account.revoke, revision.apply or project.access. |
object_kind | ticket, service_account, revision or project. |
object_id | The ticket id, the account name, the revision id or the project name. |
project | The project the object belongs to, or null when it belongs to none. |
outcome | accepted or refused. |
details | What the action carried: an answer and its comment, the ticket a rerun came from, the source of a revision. |
A project.access entry has the actor system. A new revision writes one for each project whose
access changed, in the same transaction as its revision.apply entry. Its details hold the
revision and, per role, the grants added and removed. A grant narrowed to some flows reads as its
subject and its flows in brackets. The first revision with an access block records every grant as
added. A revision that changes no access writes none.
A revision.apply entry has the actor system. Its source detail is AFE_CONFIG_SOURCE when set,
and folder:<path> otherwise.
Append-only. The store port has no update or delete for the trail. The Postgres table has
triggers that refuse UPDATE, DELETE and TRUNCATE. The owner of the database can still drop
those triggers. The trail resists the engine and every API caller. It does not resist a database owner. There is no retention yet.
Reading and exporting
A global administrator reads the whole trail. A project administrator reads only the entries of the
projects it administers, and --project narrows them further. A caller who administers no project
gets -32008. A read leaves no entry.
An administrator whose grant names some flows reads less. In that project it sees only the entries of
tickets of those flows. The entries of the project itself, such as project.access, need a grant with
no flows. In any other project the caller administers without a limit, it reads everything. Roles come from the access block of the
Project manifest.
Read the trail with afe audit, newest first. See the CLI reference for the
filters. The --format option picks the output:
| Format | Output |
|---|---|
table | Aligned columns for a terminal. |
jsonl | One JSON object per line, with every field above. |
csv | A header line, then one row per entry. |
The CSV columns are seq, at, actor_kind, actor_id, actor_name, action, object_kind,
object_id, project, outcome and details. The details column holds compact JSON. Fields with commas,
quotes or newlines are quoted.
jsonl and csv stream page by page, so an export of a long trail does not fill the memory.
Environment variables
| Variable | Read by | Meaning |
|---|---|---|
AFE_OIDC_ISSUER | serve | The OpenID Connect issuer URL. Setting it turns single sign-on on. |
AFE_OIDC_CLIENT_ID | serve | The client id the web UI signs in with. |
AFE_OIDC_CLIENT_SECRET | serve | The client secret. Never log it. |
AFE_OIDC_AUDIENCE | serve | The expected audience of access tokens. Defaults to the client id. |
AFE_OIDC_CLI_CLIENT_ID | serve | The public client afe login signs in with. Its tokens are accepted beside the API's. Unset turns afe login off. |
AFE_OIDC_GROUPS_CLAIM | serve | The token claim that lists the groups. Defaults to groups. |
AFE_OIDC_ADMIN_GROUPS | serve | Comma-separated groups that get the administrator role. |
AFE_CONFIG_SOURCE | serve, worker | Where the configuration came from, for the revision.apply entry. |
The operator sets AFE_CONFIG_SOURCE on serve and on the workers from the pod annotation
afe.dev/config-source, in the form configmap:<namespace>/<name>[@<resourceVersion>]. The
@<resourceVersion> part appears once the operator has read the source ConfigMap. The variable is
always set, so the entry never shows a folder path under the operator.
AgentFlowEngine fields
spec.deployment.api.oidc is optional. Omit it and serve gets no single sign-on variables.
| Field | Variable | Meaning |
|---|---|---|
issuer | AFE_OIDC_ISSUER | The issuer URL. |
clientId | AFE_OIDC_CLIENT_ID | The client id. |
cliClientId | AFE_OIDC_CLI_CLIENT_ID | The public client afe login signs in with. Unset turns afe login off. |
clientSecretRef | AFE_OIDC_CLIENT_SECRET | A Secret name and key. The operator names it and never reads it. |
adminGroups | AFE_OIDC_ADMIN_GROUPS | Groups with the administrator role. |
groupsClaim | AFE_OIDC_GROUPS_CLAIM | Claim with the groups. Unset keeps the default. |
audience | AFE_OIDC_AUDIENCE | Token audience. Unset means the client id. |
HTTP routes
| Route | Meaning |
|---|---|
GET /auth/config | {"oidc": true} when single sign-on is on. The login page reads it. |
GET /auth/cli | {issuer, client_id} for afe login, or 404 when single sign-on or AFE_OIDC_CLI_CLIENT_ID is off. |
GET /auth/oidc/start | Starts the sign-in and redirects to the provider. |
GET /auth/oidc/callback | Finishes the sign-in and sets the session cookie. Register this address as the redirect URI. |
See also
- Single sign-on
- Service accounts
- API for the JSON-RPC methods.