Mint CLI API keys from the dashboard for headless authentication - #2076
Merged
Conversation
Adds a Cap CLI access section to dashboard account settings that mints cap_cli_ tokens into the existing agent_api_keys table, with the same creator/admin/full scope profiles as cap auth login, an expiry allowlist (30/90/365 days), and one-time masked display of the plaintext key. Listing and revocation are scoped to the signed-in user, and creation shares the rl_agent_authorization rate-limit bucket with the authorize page. Sign out of all devices now also revokes CLI API keys, since a compromise-response control next to long-lived credentials must cover them; the dialog copy says so. Closes #2053
CAP_API_KEY values with the cap_cli_ prefix now resolve as agent credentials, so a key minted in the dashboard authenticates every agent command instead of falling into the legacy desktop path and failing. Legacy desktop keys without the prefix behave exactly as before. cap auth logout now names whichever env var actually supplied the token, cap upload --video-id fails loudly on the agent path instead of silently uploading to a new video, and the not-signed-in hint plus help and guide text point at the dashboard page where keys are minted.
Adds a headless environments section to the agent setup guide covering minting a key from account settings, injecting it as CAP_API_KEY or CAP_AGENT_TOKEN, and verifying with cap auth status. The REST API page now disambiguates cpk_/csk_ developer keys from cap_cli_ CLI keys.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Member
Author
|
hey @greptileai, please re-review the PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2053
What
There was no way to authenticate the Cap CLI in a headless environment:
cap auth loginneeds a browser on the same machine, and theCAP_API_KEYmentioned in the CLI's error message had no place to be minted.cap_cli_API key with an access profile (creator,admin, orfull, identical scope sets tocap auth login) and an expiry (30/90/365 days). The plaintext key is shown once, masked with a copy button; only its sha256 hash is stored. Keys minted bycap auth loginappear in the same list, and any key can be revoked.CAP_API_KEYvalues with thecap_cli_prefix now resolve as agent credentials, so a minted key authenticates every agent command and MCP tool. Legacy desktop keys behave exactly as before.cpk_/csk_developer keys from CLI keys.No schema change: keys go into the existing
agent_api_keystable using the same token format, hashing, and server middleware as the OAuth flow.Behavior changes to be aware of
cap upload --video-idon the agent path fails loudly instead of silently uploading to a brand-new video (pre-existing silent misbehavior).cap auth logoutnames whichever env var actually supplied the token instead of always sayingCAP_AGENT_TOKEN.Verification
CAP_AGENT_TOKEN, legacyCAP_API_KEY, desktop login, keyring, file) was walked through: behavior unchanged.Deploy note
Minting reuses the
rl_agent_authorizationVercel Firewall rule. If that rule is not configured in the firewall dashboard, rate limiting fails open (authenticated users only, same exposure as the existing authorize page). Worth creating the rule.Suggested smoke test on the preview deploy: mint a key, then
CAP_API_KEY=<key> cap auth status --json.Greptile Summary
The PR adds dashboard-minted API keys for headless CLI authentication and routes
cap_cli_credentials through the existing agent-authentication path.CAP_API_KEYacross CLI agent commands and improves authentication guidance and errors.Confidence Score: 5/5
The PR appears safe to merge.
The previously reported silent key-load failure now renders an explicit warning, and the active-key query no longer truncates the list; no blocking failure remains.
Important Files Changed
Reviews (2): Last reviewed commit: "fix(web): list every active CLI API key ..." | Re-trigger Greptile