Prioritize LOCALSTACK_AUTH_TOKEN over stored credentials - #415
Open
gtsiolis wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
gtsiolis
force-pushed
the
devx-1023-environment-auth-token-should-override-stored-8cf6
branch
from
August 4, 2026 22:44
521544e to
33318d2
Compare
gtsiolis
marked this pull request as ready for review
August 4, 2026 22:44
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
Stored keyring credentials previously overrode
LOCALSTACK_AUTH_TOKEN. Once a user had logged in, a token supplied for a CI job, a second account, or a single invocation was silently ignored until the stored credential was removed.This change makes caller-provided authentication authoritative. Token resolution is now:
LOCALSTACK_AUTH_TOKENThe non-interactive resolution used by telemetry, snapshot commands, extensions, and emulator startup shares the same precedence helper as
auth.GetToken, preventing the two paths from drifting. Tokens are trimmed before resolution, so an empty or whitespace-only environment value does not mask a valid stored credential.This also composes with DEVX-1022's authentication boundary. An environment token overrides a stored token and is sent as the caller credential for both local and external emulator-backed Cloud Pod operations. Reuse of a locally managed emulator's startup identity is only considered when neither an environment nor stored caller token is available; external targets still require caller authentication.
Logout behavior is unchanged: it removes stored credentials, while an environment-provided token remains controlled by the caller's environment.
Verification
go test ./internal/auth ./cmdmake test-integration RUN='Test(EnvAuthTokenOverridesStoredToken|StoredTokenUsedWithoutEnvAuthToken)'make test-integration RUN='TestLogoutCommand(RemovesToken|SucceedsWhenNoToken|WithEnvVarToken)$'go vet ./...in the root and integration-test modulesReview: advisable — this changes credential precedence for every authenticated command and defines how explicit caller credentials interact with the local-emulator identity fallback.
Co-Authored-By: Claude noreply@anthropic.com
Closes DEVX-1023