Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(aws-cdk): (Disallow CDK Bootstrap to default AdministratorAccess for cfn-exec-role) #27097

Open
2 tasks
smislam opened this issue Sep 11, 2023 · 2 comments
Open
2 tasks
Labels
feature-request A feature should be added or improved. p2 package/tools Related to AWS CDK Tools or CLI

Comments

@smislam
Copy link

smislam commented Sep 11, 2023

Describe the feature

By default, CDK Bootstrap uses AdministratorAccess for cfn-exec-role when we run the cdk bootstrap command. This allows CDK to have higher privileges that the user is authorized to perform and poses a security concern. Feature request is to make '--cloudformation-execution-policies' parameter mandatory.

Use Case

In my account, the account administrator disabled using AdministratorAccess. The account also has Config rules to remove AdministratorAccess access if found. We also have a security policy that removes the CDK S3 bucket first day of a month. Since we require re-bootstrapping the account each month, it would be ideal to make cdk bootstrap '--cloudformation-execution-policies' parameter mandatory. That way, it will force us to pass the right cfn-exec-role than to have CDK default to AdministratorAccess role.

Proposed Solution

Make '--cloudformation-execution-policies' parameter mandatory

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.94.0 (build 987c329)

Environment details (OS name and version, etc.)

AWS Workspace (Microsoft Windows Server 2016 DataCenter 10.0.14393 Build 14393)

@smislam smislam added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Sep 11, 2023
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Sep 11, 2023
@indrora
Copy link
Contributor

indrora commented Sep 11, 2023

@indrora indrora added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Sep 11, 2023
@smislam
Copy link
Author

smislam commented Sep 11, 2023

Hi @indrora, Thank you for sending the permission boundary information. We are actually enforcing a few things to securing the accounts that also include permission boundaries:

  1. Have IAM role with restricted permissions for users
  2. Have AWS Config Rule to flag and remove AdministratorAccess role
  3. Implement Permission Boundary to restrict users to allowed policies --> We haven't implemented this yet

As you already called out, the Permission Boundary will restrict users and cdk to only the permission they should have. However, we still need to remove the default AdministratorAccess role when bootstrapped without the --cloudformation-execution-policies' parameter. Our Security and Policy scanning tool finds the AdministratorAccess role and flagging the accounts status as violation. The Config Rules then removes that entry making CDK unusable.

if (trustedAccounts.length === 0 && cloudFormationExecutionPolicies.length === 0) {

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Sep 11, 2023
@scanlonp scanlonp added the p2 label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. p2 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

3 participants