Repository navigation
Conversation
Requests to a stack carried the session's own access token, which every environment the user can reach would accept. For environments signing in with the default auth provider, the CLI now exchanges it with the Portal for a short-lived token minted for that one environment, and sends only that to the stack: StackAPI, the game server's admin API, and the Kubernetes API proxy's exec credential alike. An environment with a custom auth provider is sent that provider's token as before. There is no fallback: if the Portal does not mint a token, the command fails rather than send the session's.
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.
Summary
Requests to a stack carried the session's own access token, which every environment the user can reach accepts. For an environment on the default auth provider, the CLI now exchanges that token with the Portal for one minted for that environment alone (
client_idis the environment), and sends only that to the stack.The same token reaches every stack-facing path:
TargetEnvironment, in every command that builds one.debug admin-request.get kubernetes-execcredential --proxy, which reports that token's own expiry to kubectl.The session's token still goes to the Portal and the auth provider, and to nothing else. There is no fallback: if the Portal does not mint a token, the command fails. It never sends the session's token instead.
Supersedes #117, rebuilt on current
main. Since #117 was opened,maingained new commands that reach a stack, a constructor taking a StackAPI base URL, and the Kubernetes API proxy exec credential, all covered here.Evidence
Before: a stack received the session's access token, with the CLI's OAuth2 client ID (or a machine user's own) as
client_id, valid for the session's lifetime.After: a stack receives a Portal-issued token with
client_idset to the target environment and a few minutes' lifetime. Verified end to end against a stack whose StackAPI trusts the Portal as an issuer, both as a human user and as a machine user:get environment-infodebug admin-request GET api/hellodebug server-statusdebug logssecrets listimage push/image listdeploy serverget server-infoget kubeconfig --type=dynamic, thenkubectl get podsthrough the proxyThe stack verified every user token as Portal-issued for that environment.
Exchanging for an environment the user cannot reach gets the Portal's 404 and no credential.
Unit tests:
go vet ./...,go test ./...andgo mod tidyare clean.Merge Danger
Door: two-way
Reverting restores the old token handling. Nothing is stored or migrated.
Blast Radius: every stack-facing command
A stack whose StackAPI does not yet accept Portal-issued user tokens refuses every request this CLI makes there. Hold the release until every stack the CLI must reach runs a StackAPI that does. Every command reaching a stack also makes one extra request to the Portal, so the Portal being unavailable now blocks those commands too.