fix: Support AWS CLI v2 SSO cache and CLI assume-role cache#87
Merged
huseyinbabal merged 1 commit intomasterfrom Jan 15, 2026
Merged
fix: Support AWS CLI v2 SSO cache and CLI assume-role cache#87huseyinbabal merged 1 commit intomasterfrom
huseyinbabal merged 1 commit intomasterfrom
Conversation
Fix issue where taws doesn't recognize active sessions created by other tools (AWS CLI v2, external apps). Changes: 1. SSO Token Cache (sso.rs): - Support CLI v2 format: SHA1(sso_session) for cache file name - Support CLI v1/legacy format: SHA1(sso_start_url) as fallback - Support both snake_case and camelCase field names via serde aliases - Make region field optional (not all cache files have it) 2. AWS CLI Assume-Role Cache (credentials.rs): - Read cached credentials from ~/.aws/cli/cache/ - Match cache files by comparing role ARN and account ID - Check expiration before using cached credentials - Fall back to performing STS AssumeRole if no valid cache found 3. Tests: - Add tests for CLI cache file matching logic - Add tests for expired credential handling - Add tests for non-matching role ARNs This allows taws to use credentials cached by: - aws sso login (CLI v2) - aws sts get-caller-identity --profile <assume-role-profile> - External tools that populate ~/.aws/cli/cache/ Closes #85
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
Fix issue where taws doesn't recognize active sessions created by other tools (AWS CLI v2, external apps).
Closes #85
Changes
1. SSO Token Cache (
sso.rs)SHA1(sso_session)for cache file nameSHA1(sso_start_url)as fallbacksnake_caseandcamelCasefield names via serde aliasesregionfield optional (not all cache files have it)2. AWS CLI Assume-Role Cache (
credentials.rs)~/.aws/cli/cache/3. Tests
What This Enables
taws can now use credentials cached by:
aws sso login(CLI v2)aws sts get-caller-identity --profile <assume-role-profile>~/.aws/cli/cache/Priority Order for Role Assumption Profiles
When a profile has
role_arnconfigured:~/.aws/cli/cache/for existing valid credentialsThis avoids unnecessary API calls when valid credentials already exist.