Skip to content

Commit 53bd4a5

Browse files
committed
Fix aws.sh SSO credential check to use export-credentials
The old early-exit used `aws sts get-caller-identity && aws ec2 describe-instances`, which can pass via env vars or static credentials even when the SSO token is expired. boto3/polars uses the SSO profile directly, so it would fail with UnauthorizedSSOTokenError while the CLI check reported "already valid". Replace with `aws configure export-credentials --format json`, which exercises the full SSO credential chain and fails if the SSO token is expired — matching exactly what boto3 checks. Made-with: Cursor
1 parent 1c0c939 commit 53bd4a5

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

.devcontainer/devpod/aws.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ if ! command -v aws >/dev/null 2>&1; then
2020
exit 1
2121
fi
2222

23-
# Check if credentials are already valid (early exit if so)
24-
# Test with an actual EC2 API call since DevPod uses EC2
25-
if aws sts get-caller-identity &>/dev/null &&
26-
aws ec2 describe-instances --max-results 5 &>/dev/null; then
23+
# Check if SSO credentials are already valid (early exit if so).
24+
# aws configure export-credentials exercises the full SSO credential chain,
25+
# so it fails if the SSO token is expired — unlike aws sts get-caller-identity,
26+
# which can succeed via env vars or static credentials even when SSO is stale.
27+
if aws configure export-credentials --format json &>/dev/null; then
2728
echo "✅ AWS credentials are already valid"
2829
echo
2930
exit 0

0 commit comments

Comments
 (0)