Repository navigation
feat(auth): mint and refresh the managed run token (DEP-7956) - #653
Merged
Merged
Conversation
…-7956) When no token is passed, set in DEPOT_TOKEN, or saved in config, and DEPOT_RUN_TOKEN_URL names the sandbox identity endpoint, the CLI fetches its own JWT-SVID from it. API clients swap that token for a fresh one on each request once it is within a minute of expiry, so commands that run past the five-minute SVID lifetime, like `depot ci status --wait`, keep their auth. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01RQk3K7YZTbRjnM8126LcSg
…P-7956) `depot gocache` serves for a whole build, so its cache client now swaps the run token per request too. `depot configure-docker` saves its token into the buildx config, so it refuses one that expires in minutes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01RQk3K7YZTbRjnM8126LcSg
…P-7956) `depot cargo` hands its token to sccache, which cannot refresh it, so the cache tools keep DEPOT_CACHE_TOKEN or DEPOT_JIT_TOKEN over a run token. Blob pushes now go through the refreshing client. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01RQk3K7YZTbRjnM8126LcSg
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01RQk3K7YZTbRjnM8126LcSg
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a91c1cb. Configure here.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01RQk3K7YZTbRjnM8126LcSg
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 DEP-7956. In a managed run with no explicit token, the CLI mints its own five-minute run token and refreshes it before each request.
DEPOT_RUN_TOKEN_URLset: fetch{"value":"<jwt>"}from that URL. Refetch when the JWTexpis under 60s away.--token>DEPOT_TOKEN> config > run token >DEPOT_JIT_TOKEN/DEPOT_CACHE_TOKEN> OIDC.RoundTripperon the API clients replaces only tokens this source minted, so a longdepot ci status --waitkeeps working.DEPOT_CACHE_TOKEN.depot cargoandconfigure-dockerreject a run token because they hand it to a process that cannot refresh it.DEPOT_RUN_TOKEN_URLunset: behaviour is unchanged.Post-deploy test plan
Requires the API change that accepts the run token (deployed), and a sandbox that exports
DEPOT_RUN_TOKEN_URL(follow-up API PR).DEPOT_TOKENunset, start a CI run and rundepot ci status <run-id> --waitfor more than 5 minutes.unauthenticatederror. Polls keep succeeding after the first token expires.Design notes
expis read unverified and only to schedule refreshes. A token withoutexpis refetched on every request.DEPOT_RUN_TOKEN_URLin the sandbox, stop exportingDEPOT_TOKENfrom the shim, and keepNO_PROXYfor the API host.🤖 Generated with Claude Code
https://claude.ai/code/session_01RQk3K7YZTbRjnM8126LcSg
Catch up on this pull request in Depot
Note
High Risk
Changes authentication precedence and automatic token refresh across all API HTTP clients; misconfiguration could break CI sandboxes or leak short-lived tokens into tools that persist credentials.
Overview
Adds managed-run authentication when
DEPOT_RUN_TOKEN_URLis set: the CLI fetches a short-lived JWT from the sandbox endpoint, caches it until ~1 minute beforeexp, and wires an HTTPRoundTripperso API traffic only replaces Bearer tokens the run source minted—supporting long polls likedepot ci status --waitwithout manual token rotation.Auth resolution now slots the run token after config and before JIT/cache tokens;
ResolveCacheAuthkeepsDEPOT_CACHE_TOKENfor gocache/cargo.depot cargoandconfigure-dockererror if the resolved token is run-minted (subprocesses can’t refresh). Shared JSON/RPC/gocache/push clients go throughruntoken.WrapClient. With the env unset, behavior is unchanged.Reviewed by Cursor Bugbot for commit 9dcb448. Bugbot is set up for automated code reviews on this repo. Configure here.