Preventing cross account roles external to Organization?

Hi All,

Currently our developers have limited access in IAM, they can create roles provided they follow a naming convention and also attach a boundary policy to the role. But how can I prevent them from creating a role that trusts a role from an account outside our organization?

It’s totally feasible that they would do a cross account role for accounts within our organization for collaboration work, but not for outside accounts.

I tried setting a deny on iam:CreateRole with the following condition, but it does not work:

“Condition”: {
“StringNotEquals”: {
“aws:PrincipalOrgID”: [
“o-blahblah”
]
}
},

Is this the incorrect approach? What have you guys done to secure your organization from this issue?


Related discussions:

That condition will restrict non org principals from creating roles. Not really your concern I don’t think.

You are trying to restrict trust policies from trusting principals outside your org. I don’t think such conditions exist.

May need to check into a cloud compliance tool.

Cross account roles should be fairly limited in where they come from. Ideally, they would all come out of 1 or 2 accounts, so you could just put in a deny rule if it’s not from those white listed accounts.

In a SCP you might be able to put that condition on sts:assumerole and catch things that way. Haven’t tried it, but it could work