diff --git a/cmd/audit.go b/cmd/audit.go index 544a424..a2461f1 100644 --- a/cmd/audit.go +++ b/cmd/audit.go @@ -28,7 +28,7 @@ var auditCmd = &cobra.Command{ The log lists the changes made to the project through the API, each with the token, client and source address that made it: an attempt row before the change and a result row after it. Count rows sum a minute's refused requests -and requests by legacy project tokens. +and requests by agent and workload tokens. It reads the active project unless --project names another, and needs permission to manage the project. A page holds --limit rows, at most 500; diff --git a/cmd/audit_test.go b/cmd/audit_test.go index c1b36e8..fdfc950 100644 --- a/cmd/audit_test.go +++ b/cmd/audit_test.go @@ -11,10 +11,11 @@ import ( "github.com/valar/cli/api" ) +// Row 1200's token ID is in a format the CLI does not know, so it is shown whole. const auditPage = `[{"id":1201,"at":"2026-11-21T10:00:01Z","kind":"result","attemptId":1200,"principal":"human::alice","tokenId":"` + ciTokenID + `","client":"valar-cli/4.9.0","sourceIp":"192.0.2.1","service":"web","operation":"deploys.submit","target":"deployment=7","status":200,"count":0},` + - `{"id":1200,"at":"2026-11-21T10:00:00Z","kind":"attempt","principal":"human::alice","tokenId":"legacy-project","operation":"tokens.create","count":0},` + - `{"id":1190,"at":"2026-11-21T09:59:00Z","kind":"count","principal":"service::acme","operation":"env.patch","status":403,"count":3}]` + `{"id":1200,"at":"2026-11-21T10:00:00Z","kind":"attempt","principal":"human::alice","tokenId":"future-id","operation":"tokens.create","count":0},` + + `{"id":1190,"at":"2026-11-21T09:59:00Z","kind":"count","principal":"service::acme/web","operation":"env.patch","status":403,"count":3}]` func TestListAudit(t *testing.T) { for _, tc := range []struct { @@ -36,8 +37,8 @@ func TestListAudit(t *testing.T) { want := []string{ "ID TIME KIND PRINCIPAL TOKEN OPERATION SERVICE TARGET STATUS SOURCE CLIENT", "1201