IAM role must have a trust policy configured
Medium
AWS
General
aws-iam-role-content-trust
Applies to
AWS::IAM::Role
What CGPulse checks
A resource passes this rule when assumeRolePolicyDocument must be set true. Anything else is reported as a finding with the evaluated property value attached as evidence.
How to fix it
Configure a properly scoped trust policy to restrict which principals can assume the role. In AWS Console: IAM > Roles > select role > Trust relationships > Edit. See: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_manage_modify.html
Terraform
resource "aws_iam_role" "{name}" {
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Principal = { Service = "ec2.amazonaws.com" }
Action = "sts:AssumeRole"
}]
})
}
Compliance frameworks
Is your environment compliant with this rule?
CGPulse checks it — and 621 others — against your Azure and AWS accounts with read-only access.
Related AWS rules
- ACM certificate must be eligible for renewal
- ACM certificate must be in issued status
- Amplify app should have basic auth disabled for production
- API Gateway REST API must have an endpoint configuration
- API Gateway V2 API must be properly configured
- App Runner service must have encryption enabled
- AppSync API must have logging configured
- AppSync API must have X-Ray tracing enabled