Files
pad/cmd
David Barkhausen e712ca12be fix(cli): pad token create --scopes validates and JSON-encodes (#1237 follow-up) (#1329)
The flag passed its raw string into APITokenCreate.Scopes: the store
writes it verbatim and tokenScopeAllows requires a JSON array, so
'--scopes read' minted a token every request refused, with only a
server-side slog warning the CLI user never sees (#1237 review).

- comma-separated values, trimmed, validated against the server's
  recognized vocabulary (*, read, write, pad:read, pad:write,
  pad:admin) — an unknown or empty entry is refused locally, naming
  the allowed list, before any request
- valid values JSON-encoded: --scopes read posts ["read"]
  (test-pinned against the stub's recorded body)
- help text no longer says 'optional scopes string'

Also makes TestTokenList_RendersMetadataWithoutSecret falsifiable
(the review's minor note): the list stub now carries a token field
the real server never sends, so the no-secret assertion fails if the
renderer ever surfaces it — verified by reintroducing exactly that
leak and watching the test fail before reverting.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-11 18:05:43 -04:00
..