Interview Prep/AWS/IAM Best Practices

How do you protect against the confused deputy problem when AWS services assume your roles?

AdvancedProductionIAM Best Practices
Answer

Add aws:SourceArn and/or aws:SourceAccount conditions to trust policies and resource policies that grant access to service principals. That way, the service can only act on your behalf for requests originating from your resource, not another customer's. For third-party SaaS roles, require an sts:ExternalId that the vendor generates per customer.

"Condition": {"StringEquals": {"aws:SourceAccount": "111122223333"},
              "ArnLike": {"aws:SourceArn": "arn:aws:sns:eu-west-1:111122223333:alerts"}}
aws All AWS questions Roadmap: AWS core services

More on IAM Best Practices