[security] Why is the CDK using the CF service role? #23681
-
CDK bootstrapping, by default, sets up a CF execution role that has Administrator rights meaning that anyone who can deploy to CF will have escalation capabilities in a bootstrapped account. Further, once a stack has been deployed with that role, it will always thereafter use it. This seems to produce a glaring persistent escalation path. Despite guidance to customize these rights, you have to be fairly invested before it is worth digging in at which point you would be in a bind if any deployed stacks are depended upon. What is the reasoning behind the use of the service role? Why was there a switch from using the rights of the deploying entity? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
For anyone that stumbles upon this, you might find |
Beta Was this translation helpful? Give feedback.
-
@github-actions proposed-answer This permission set is broad on purpose - CloudFormation will need to do many, unspecified things in your account involving lots of different services when deploying stacks. It's simplest and easiest for customers to get up and running to have the default execution role be one that won't block use cases by default. As the documentation you linked states, it's not that hard to change the service role - Using our stack synthesizers in CDK makes it easy. Additionally, you could also change the permissions the role grants. As for why we require bootstrapping by default - it allows for much more fine-grained control regarding who can assume the deployment role, and what cloudformation has access to perform in the account through the execution role. It also makes it easier for our asset uploading process to go smoothly if bootstrapped using the modern template. Most users will want to follow this pattern - so it's the default that we set. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
@github-actions proposed-answer This permission set is broad on purpose - CloudFormation will need to do many, unspecified things in your account involving lots of different services when deploying stacks. It's simplest and easiest for customers to get up and running to have the default execution role be one that won't block use cases by default.
As the documentation you linked states, it's not that hard to change the service role - Using our stack synthesizers in CDK makes it easy. Additionally, you could also change the permissions the role grants.
As for why we require bootstrapping by default - it allows for much more fine-grained control regarding who can assume the deployment role, …