Description
On AWS::IAM::User, Policies defines inline user policies and ManagedPolicyArns attaches managed policies directly. Review each exception and the permissions it grants.
Potential impact
Peers can end up with different access, and users can retain permissions after their responsibilities change.
Remediation
Grant shared user permissions through a group and use roles with temporary credentials for workloads. Verify access through the replacement before removing direct policies. Record a reason and review date for exceptions you retain.
Examples
Supply the managed policy ARNs and myqueue referenced by the first excerpt. Review the required queue actions.
Before
AWSTemplateFormatVersion: "2010-09-09"
Description: A sample template
Resources:
myuser:
Type: AWS::IAM::User
Properties:
Path: "/"
ManagedPolicyArns:
- arn:aws:iam::123456789012:policy/UsersManageOwnCredentials
- arn:aws:iam::123456789012:policy/division_abc/subdivision_xyz/UsersManageOwnCredentials
Policies:
- PolicyName: giveaccesstoqueueonly
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- sqs:*
Resource:
- !GetAtt myqueue.Arn
- Effect: Deny
Action:
- sqs:*
NotResource:
- !GetAtt myqueue.Arn
After
AWSTemplateFormatVersion: "2010-09-09"
Description: A sample template
Resources:
myuser:
Type: AWS::IAM::User
Properties:
Path: "/"
The second excerpt removes both the inline policy and the managed policy attachments from the same user. Supply any replacement group or role separately.