feat: Add the API token endpoints

Create, list and revoke, with no update: editing what a credential already
deployed in CI can do, with no record of what it could do before, is worse
than requiring a rotation. Revoking a token that is not yours answers
not-found, since a 403 confirms it exists.

The audit actor stays the human and names the credential alongside, so a
person clicking and their CI job are told apart.
This commit is contained in:
2026-08-12 14:44:50 +00:00
parent be4f488db3
commit 524ccc6412
4 changed files with 122 additions and 3 deletions
+5
View File
@@ -38,6 +38,7 @@ export const AUDIT_CATEGORIES: { value: string; label: string }[] = [
{ value: "updates", label: "OS updates" },
{ value: "auth_provider", label: "Single sign-on" },
{ value: "settings", label: "Settings" },
{ value: "token", label: "API tokens" },
{ value: "license", label: "Licence" },
{ value: "instance", label: "Instance" },
];
@@ -98,6 +99,10 @@ const OVERRIDES: Record<string, string> = {
"instance.reaped": "Instance deleted",
"vuln.rescan": "Rescan requested",
"workload.logs_read": "Workload logs read",
"token.created": "API token created",
"token.revoked": "API token revoked",
"token.expired_use": "Expired API token used",
"settings.token_policy_updated": "API token policy updated",
};
export interface AuditEventDisplay {