Skip to main content

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 kindCredentialAdministrator
localthe bootstrap token AFE_API_TOKEN.yes
service_accounta token starting with afe_sa_.never
personan OpenID Connect token, or a browser session.when a group is in AFE_OIDC_ADMIN_GROUPS
systemnone: 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.

FieldMeaning
seqIncreasing number the store assigns.
atWhen the action happened, as an ISO 8601 instant.
actorThe caller: kind, id, name, groups (at most the first 50).
actionticket.start, ticket.rerun, ticket.resume, ticket.pause, ticket.cancel, ticket.clean, service_account.create, service_account.revoke, revision.apply or project.access.
object_kindticket, service_account, revision or project.
object_idThe ticket id, the account name, the revision id or the project name.
projectThe project the object belongs to, or null when it belongs to none.
outcomeaccepted or refused.
detailsWhat 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:

FormatOutput
tableAligned columns for a terminal.
jsonlOne JSON object per line, with every field above.
csvA 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​

VariableRead byMeaning
AFE_OIDC_ISSUERserveThe OpenID Connect issuer URL. Setting it turns single sign-on on.
AFE_OIDC_CLIENT_IDserveThe client id the web UI signs in with.
AFE_OIDC_CLIENT_SECRETserveThe client secret. Never log it.
AFE_OIDC_AUDIENCEserveThe expected audience of access tokens. Defaults to the client id.
AFE_OIDC_CLI_CLIENT_IDserveThe public client afe login signs in with. Its tokens are accepted beside the API's. Unset turns afe login off.
AFE_OIDC_GROUPS_CLAIMserveThe token claim that lists the groups. Defaults to groups.
AFE_OIDC_ADMIN_GROUPSserveComma-separated groups that get the administrator role.
AFE_CONFIG_SOURCEserve, workerWhere 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.

FieldVariableMeaning
issuerAFE_OIDC_ISSUERThe issuer URL.
clientIdAFE_OIDC_CLIENT_IDThe client id.
cliClientIdAFE_OIDC_CLI_CLIENT_IDThe public client afe login signs in with. Unset turns afe login off.
clientSecretRefAFE_OIDC_CLIENT_SECRETA Secret name and key. The operator names it and never reads it.
adminGroupsAFE_OIDC_ADMIN_GROUPSGroups with the administrator role.
groupsClaimAFE_OIDC_GROUPS_CLAIMClaim with the groups. Unset keeps the default.
audienceAFE_OIDC_AUDIENCEToken audience. Unset means the client id.

HTTP routes​

RouteMeaning
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/startStarts the sign-in and redirects to the provider.
GET /auth/oidc/callbackFinishes the sign-in and sets the session cookie. Register this address as the redirect URI.

See also​