Trust role policy generated for IAM role does not have controls for conditionals like aws:SourceArn, aws:SourceAccount, aws:SourceOrgID, or aws:SourceOrgPaths used for confused deputy problem prevention. Workaround for the problem is to provide custom trust policy with appropriate conditions for role assumption, however I think we should promote good security practices and have some of these controls added to role modules and perhaps enabled by default at some point in the future.
If approved I'm willing to submit PR (for start maybe just one conditional, like aws:SourceAccount) with backward compatible changes to test it out.
[X] ✋ I have searched the open/closed issues and my issue is not listed.
Description
Trust role policy generated for IAM role does not have controls for conditionals like
aws:SourceArn
,aws:SourceAccount
,aws:SourceOrgID
, oraws:SourceOrgPaths
used for confused deputy problem prevention. Workaround for the problem is to provide custom trust policy with appropriate conditions for role assumption, however I think we should promote good security practices and have some of these controls added to role modules and perhaps enabled by default at some point in the future.If approved I'm willing to submit PR (for start maybe just one conditional, like
aws:SourceAccount
) with backward compatible changes to test it out.Versions
Steps to reproduce the behavior:
Generated trust policy looks like this:
Expected behavior
We should be able to generate policy like this
Actual behavior
There is no option to add conditions except for:
aws:PrincipalArn
Terminal Output Screenshot(s)
Additional context