Skip to content

fix(deploy): fail fast on AWS account mismatch#1787

Open
notgitika wants to merge 1 commit into
mainfrom
fix/deploy-account-mismatch
Open

fix(deploy): fail fast on AWS account mismatch#1787
notgitika wants to merge 1 commit into
mainfrom
fix/deploy-account-mismatch

Conversation

@notgitika

Copy link
Copy Markdown
Contributor

Summary

  • validate that active AWS credentials belong to the selected deployment target account
  • run the check during preflight, before CDK build, synth, and asset publishing
  • apply the same validation to CLI and TUI teardown deploys after confirmation
  • preserve existing credential validation behavior for callers without a deployment target

The account comparison is integrated into validateAwsCredentials, so credential validity and target ownership are checked with one STS GetCallerIdentity request. Mismatches now name both account IDs and the selected target instead of surfacing later as a generic CDK asset publishing error.

Testing

  • npx vitest run --project unit src/cli/aws/__tests__/account-extended.test.ts src/cli/operations/deploy/__tests__/preflight.test.ts src/cli/commands/deploy/__tests__/deploy-teardown.test.ts
  • npm run typecheck
  • focused ESLint and Prettier checks
  • npm run build

Fixes #761

@notgitika
notgitika requested a review from a team July 17, 2026 02:20
@github-actions github-actions Bot added the size/s PR size: S label Jul 17, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jul 17, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jul 17, 2026
@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jul 17, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jul 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.24.1.tgz

How to install

gh release download pr-1787-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.24.1.tgz

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 39.99% 14853 / 37137
🔵 Statements 39.25% 15828 / 40325
🔵 Functions 34.03% 2527 / 7425
🔵 Branches 33.49% 9900 / 29561
Generated in workflow #4139 for commit 1de3399 by the Vitest Coverage Report Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better error handling during deploy for valid creds but for a different account

1 participant