Skip to content

[app-token 2/4] token revoke and --expires-at - #157

Merged
emupton merged 2 commits into
feat/application-token/01-create-listfrom
feat/application-token/02-revoke-expiry
Nov 18, 2026
Merged

emupton merged 2 commits into
feat/application-token/01-create-listfrom
feat/application-token/02-revoke-expiry

Conversation

@emupton

@emupton emupton commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Why

Console is introducing the ApplicationToken kind, scoped to a self-serve Application, closing a vulnerability where an ApplicationInstance token (e.g. a dev environment's CI token) could modify ApplicationGroups and grant itself production access. Alongside the new kind, Console adds token revocation and token expiry; this slice brings both to the CLI so compromised or stale tokens can be neutralized without deleting their audit trail.

What this PR does

  • conduktor token revoke <token-uuid> calling the new POST /api/token/v1/{token-uuid}/revoke. Unlike token delete, revocation is terminal: the token stays listed with a Revoked status.
  • Optional --expires-at (RFC3339) on token create admin and token create application. Validated client-side; expiresAt is only sent when the flag is set, so creating tokens against older Consoles keeps working and absent still means "never expires".
  • Token struct gains ExpiresAt and Status (omitempty — older servers won't send them); token list application prints them when present.
  • httpmock tests: revoke success/404, expiresAt sent when set, omitted when not, list parsing of the new fields.

Milestone: full Application-token lifecycle (mint, list, expire, revoke) from ctl — against a mock; live verification once the Console backend merges.

How to verify

go build ./... && go test ./pkg/client/ -run 'Revoke|ExpiresAt|ParsesExpiry' -v
./conduktor token create application -a myapp ci --expires-at 2027-01-01T00:00:00Z
./conduktor token revoke <uuid>

Stack: PR 2/4, on top of #156.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@emupton
emupton force-pushed the feat/application-token/02-revoke-expiry branch from fff09dc to 9f273f9 Compare November 17, 2026 11:33
@emupton
emupton marked this pull request as ready for review November 17, 2026 13:29

@bthuillier bthuillier left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contract matches console-plus 👍. Please drop --expires-at from token create admin: Console ignores it for admin tokens, so it gives a false sense of expiry. Keep it on create application only.
Nit: token revoke only works for application tokens, worth saying in the help.

…-only

Review follow-ups on the revoke/--expires-at PR:
- Console ignores expiresAt when creating admin tokens, so exposing --expires-at
  on `token create admin` gave a false sense of expiry. Remove the flag; keep it
  on `token create application`, where expiry is honoured. CreateAdminToken no
  longer sends expiresAt.
- `token revoke` only works for application tokens (other kinds can only be
  deleted); say so in the command help.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@emupton

emupton commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Both addressed in f1da669:

  • Dropped --expires-at from token create admin — the flag is gone, CreateAdminToken no longer sends expiresAt, and passing it now errors with unknown flag. Kept it on token create application, where Console honours it. Updated the client test to assert admin never sends expiresAt.
  • token revoke help now says it's application-token-only: "Only application tokens can be revoked; other kinds can only be deleted."

Verified end-to-end against a local Console (admin create still works without the flag; application --expires-at and revoke→Revoked→401 all behave). 03/04 restacked on top; go build/go test ./... green.

@emupton
emupton merged commit 87e9355 into main Nov 18, 2026
7 checks passed
@emupton
emupton deleted the feat/application-token/02-revoke-expiry branch November 18, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants