Description
In a role trust policy, an account ARN ending in :root delegates to that account. Its administrator can grant users or roles permission to assume the target role.
Potential impact
Widening permissions in the trusted account can give additional identities access. The target role's permissions determine what they can do.
Remediation
If only one role needs access, set Principal to its ARN. If the whole account needs delegation, check who can grant or use that access. Limit the target role's permissions and test that approved cross-account calls succeed and others fail.
Examples
Use the approved account and calling role ARN. Configure caller permissions and the target role's workload permissions separately.
Before
- name: IAM 정책 생성
community.aws.iam_managed_policy:
policy_name: ManagedPolicy
policy:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action: logs:CreateLogGroup
Resource: "*"
Principal:
AWS: arn:aws:iam::123456789012:root
make_default: false
state: present
This logs:CreateLogGroup statement is in a managed policy, where Principal is invalid. It creates no trust relationship.
After
- name: Configure trust for an approved role
amazon.aws.iam_role:
name: log-writer-target-role
assume_role_policy_document: >
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Principal": {
"AWS": "arn:aws:iam::123456789012:role/log-writer-role"
}
}
]
}
state: present
The trust statement on log-writer-target-role names log-writer-role. Review other trust statements for additional callers.