Description
An account ARN ending in :root lets that account's administrators grant IAM users or roles access to your role. A cross-account caller also needs sts:AssumeRole permission in its own account.
Potential impact
If the trusted account expands those permissions, more identities can use the target role. Its permissions determine which resources are affected.
Remediation
Trust the calling role's ARN if only one role needs access. If account-wide delegation is necessary, document why and review who receives access. Limit STS actions and conditions to the integration's needs. Verify that approved calls succeed and other calls are denied.
Examples
Set var.name_tag_prefix, create the calling role first and use its actual ARN. Grant the target role the CloudWatch Logs permissions it needs in a separate policy.
Before
resource "aws_iam_role" "example" {
name = "${var.name_tag_prefix}-openshift-instance-forward-logs"
path = "/"
description = "Allows an instance to forward logs to CloudWatch"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Principal": {
"AWS": "arn:aws:iam::111122223333:root"
},
"Effect": "Allow",
"Action": "sts:AssumeRole"
}
]
}
EOF
}
This statement delegates access to account 111122223333.
After
resource "aws_iam_role" "example" {
name = "${var.name_tag_prefix}-openshift-instance-forward-logs"
path = "/"
description = "Allows an instance to forward logs to CloudWatch"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Principal": {
"AWS": "arn:aws:iam::111122223333:role/log-forwarder"
},
"Effect": "Allow",
"Action": "sts:AssumeRole"
}
]
}
EOF
}
The same target role now trusts the log-forwarder role in that account.