Skip to main content
← Back to list
01Issue
FeatureShippedSwamp CLIPublicEnterprise
Assigneesstack72

Relationships

#3768 auth login leaves a new active API token per login; no cleanup process

Opened by tagur · 10/22/2026· Shipped 10/22/2026

Problem

Each swamp auth login creates a new cli-<host>-<epoch-ms> API token. Old tokens stay active. swamp auth logout revokes only the stored key, so re-login without logout, or a wiped credential store, orphans the old token.

Observed on one account: 10 active tokens, 8 unused for 14+ days, oldest created May 2026, all from the same host. Revocation today is manual, one token at a time, in the web UI.

Options

  1. Idle expiry (server-side). Tokens unused for N days (default 90) expire automatically. Optional per-account setting. Fixes orphans from any cause. Needs a server change.
  2. Reuse or replace on login (CLI). Before creating a token, login revokes the prior stored key, or reuses the existing token for the same host label. Stops growth at the source. Cannot clean tokens whose local store is already gone.
  3. Explicit prune command. swamp auth token prune --unused-days N [--dry-run] revokes the account's CLI tokens idle for N days. Opt-in, scriptable, works on existing backlog.
  4. Absolute lifetime. Fixed TTL per token (for example 1 year) with re-login prompt. Simple, but forces re-auth for active tokens.
  5. Stable per-host token name. Use cli-<host> without the timestamp so a second login conflicts or replaces instead of adding. Smallest change, weak alone.

Recommendation

Option 2 plus option 1. Option 2 stops new orphans. Option 1 cleans the rest. Option 3 is a cheap interim step for the existing backlog.

  • auth logout already revokes the stored key. No path exists for tokens whose local copy is gone.
02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 10 MOREPR_LINKED+ 2 MORESESSION_SUMMARIZED

Shipped

10/22/2026, 10:24:05 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
tagur moved this from the private collective Two Nines to public10/22/2026, 3:03:15 AM
stack72 assigned stack7210/22/2026, 4:35:44 PM
Editable. Press Enter to edit.

stack72 commented 10/22/2026, 11:05:55 PM

@tagur thanks for the clear write-up and the options. You were right that idle expiry is the fix: a key minted by swamp auth login now expires 90 days after its last use, and every use pushes that forward. A key in use on any machine or in CI keeps working, and keys nobody uses any more clean themselves up. Older login keys got the same rule on deploy: any idle for more than 90 days are already gone, and the rest expire 90 days after their last use unless they're used again. The Access Tokens panel on your profile now shows when each key expires. Shipped in swamp-club/swamp-club#1397, with you as co-author.

Sign in to post a ripple.