Skip to content

feat(org): add token lifecycle commands - #635

Draft
ImLunaHey wants to merge 3 commits into
mainfrom
luna/dep-6124-org-token-lifecycle
Draft

ImLunaHey wants to merge 3 commits into
mainfrom
luna/dep-6124-org-token-lifecycle

Conversation

@ImLunaHey

@ImLunaHey ImLunaHey commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Add owner-authenticated organization API-token lifecycle commands:

depot org tokens list --organization <org-id> --output json
depot org tokens create --organization <org-id> --description 'CI builds' --output json
depot org tokens revoke <token-id> --organization <org-id>
  • Require an owner's user API token from saved login, DEPOT_TOKEN, or --token.
  • List safe metadata with pagination; print the secret only at creation; revoke by exact ID.
  • Keep JSON output separate from storage guidance, preserve the saved login credential, and avoid automatic creation retries.
  • Refuse redirects for token-management requests so owner credentials and mutations stay at the selected API endpoint.
  • Add the generated service client, command documentation, and HTTP Connect lifecycle/error tests.

Requires depot/api#5890 to deploy before these commands are released. Existing server authentication caches can continue accepting revoked tokens until their entries expire. Previously issued registry JWTs and log grants retain their signed expiry; independent pull/build credentials retain their own lifecycle.

Validation: full Go tests/lint, dependency and formatting checks, native CLI build, generated-proto parity, NPM formatting/type-check. Cross-platform release packaging runs in CI.


Note

High Risk
Introduces credential creation/revocation and hardens token API HTTP behavior; mistakes or misuse affect org-wide API access.

Overview
Adds depot org tokens under depot org so organization owners can list, create, and revoke organization API tokens from the CLI, backed by a new OrganizationTokenService proto/Connect client and NewOrganizationTokensClient() in the API layer.

The commands require an owner user API token (depot login, DEPOT_TOKEN, or --token) and a selected org (--organization, DEPOT_ORG_ID, or current org). List returns metadata only with pagination; create shows the secret once on stdout (guidance on stderr) and does not overwrite saved login credentials or auto-retry; revoke targets an exact token ID. Token-management HTTP calls use a dedicated client that refuses redirects so owner credentials are not replayed on follow-up requests.

README documents usage, limits, and revocation/cache behavior. Tests cover the command lifecycle, validation, errors, and redirect policy.

Reviewed by Cursor Bugbot for commit 33b39da. Bugbot is set up for automated code reviews on this repo. Configure here.

@linear-code

linear-code Bot commented Oct 16, 2026

Copy link
Copy Markdown

DEP-6124

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.

1 participant