Repository navigation
Conversation
Setup does not change a role without the ldcli:managed tag. If the trust policy of that role allows only agent spaces in another region, setup made an agent space and then failed to associate the account with it. The plan now reads the trust policy of each unmanaged role that the run uses. If the policy does not allow the agent space, setup stops before it changes AWS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5832954. Configure here.
| } | ||
| } | ||
|
|
||
| return false, true |
There was a problem hiding this comment.
ArnEquals wildcards treated as exact
Medium Severity
conditionMatches treats ArnEquals as a literal string match. IAM treats ArnEquals and ArnLike as the same operator, and both honor * and ?. An unmanaged role that already allows arn:aws:aidevops:*:<account>:agentspace/* through ArnEquals is valid, but setup still stops before it changes AWS.
Reviewed by Cursor Bugbot for commit 5832954. Configure here.


setupdoes not change a role that has noldcli:managedtag. Before this change, the plan did not read the trust policy of that role. If the policy allowed only agent spaces in another region,setupmade an agent space and then failed withInvalid STS role configuration. The new agent space then had no account association, no operator app, and no MCP server.The plan now reads the trust policy of each unmanaged role that the run uses. The agent space role must allow
sts:AssumeRoleif the run associates the account. The operator app role must allowsts:AssumeRoleandsts:TagSessionif the run turns on or changes the operator app. If a policy does not letaidevops.amazonaws.comdo this for an agent space in the current region,setupstops before it changes AWS. The error names the role and the fix.The check stops the plan only if the policy clearly blocks the agent. If
setupcannot read the policy, or the policy uses a condition operator that the check does not know, the plan continues. The check reads only theaws:SourceArncondition.To test the change, run
go test ./internal/awsdevops/. I found the problem in a development account. ItsDevOpsAgentRole-AgentSpacerole trusted onlyarn:aws:aidevops:us-east-1:..., andsetupran in us-west-2.🤖 Generated with Claude Code
Note
Overview
aws-devops-agent setupnow validates IAM trust policies during planning before any AWS changes, fixing a failure mode where setup could create an agent space and then die on account association withInvalid STS role configuration.For unmanaged roles (no
ldcli:managedtag) that the run still depends on, the plan reads each role’s assume-role policy and checks thataidevops.amazonaws.comcan call the needed STS actions for agent spaces in the current region—sts:AssumeRoleon the agent-space role when associating the account, andsts:AssumeRole+sts:TagSessionon the operator-app role when enabling or changing the app. If the policy clearly blocks that (e.g.aws:SourceArnpinned to another region), setup stops with a message that names the role and how to fix it (broaden the trust or add the managed tag so ldcli updates the role).Validation is conservative: unreadable policies, unknown condition operators, or roles not used by this run do not block the plan. New logic lives in
trust.go; tests cover region mismatch, missingTagSession, and skipped checks when association/app steps don’t need a role.README documents this pre-flight trust check for customer-owned roles.
Reviewed by Cursor Bugbot for commit 5832954. Bugbot is set up for automated code reviews on this repo. Configure here.