Skip to content
New issue

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

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

Already on GitHub? # to your account

Disable fallback to user's role when a cdk-* role cannot be assumed #30236

Open
2 tasks
lobodpav opened this issue May 16, 2024 · 2 comments
Open
2 tasks

Disable fallback to user's role when a cdk-* role cannot be assumed #30236

lobodpav opened this issue May 16, 2024 · 2 comments
Labels
@aws-cdk/aws-iam Related to AWS Identity and Access Management effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@lobodpav
Copy link

Describe the feature

When running deploy or destroy commands, it would be amazing if the CDK would fail when a cdk-* role cannot be assumed (e.g. cdk-lookup or cdk-deploy).

Use Case

It's very easy to use/paste an incorrect Account ID in the CDK_DEPLOY_ACCOUNT when running CDK locally. When that happens, users can accidentally deploy local changes to the production environments.

I know that it would have to be a coincidence of selecting the wrong account ID along with the wrong profile. However, if CDK would not fall back to the user's profile by default, it would be possible to define a Trust policy at the cdk-* role level allowing only pipelines (e.g. OIDC roles) to perform production deployments.

Proposed Solution

  1. Prevent a fallback to the user's role when the cdk-* role cannot be assumed.
  2. Introduce a --force parameter that would fall back to the user's role even if the CDK roles can't be assumed.

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.140.0

Environment details (OS name and version, etc.)

macOS 14.5

@lobodpav lobodpav added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels May 16, 2024
@github-actions github-actions bot added the @aws-cdk/aws-iam Related to AWS Identity and Access Management label May 16, 2024
@pahud
Copy link
Contributor

pahud commented May 16, 2024

Thank you for your feedback. We definitely need to hear more thoughts from the community. Please help us prioritize with 👍.

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels May 16, 2024
@moltar
Copy link
Contributor

moltar commented Jun 5, 2024

I think I'm running into a similar issue in a different context.

I'm using CodeBuild for GitHub Actions runners. And CodeBuild of course has native identity via EC2 metadata lookup.

So synth step always tried to use it for lookup and of course the CodeBuild doesn't have the right policies because it's only meant to be used for GH Actions which just performs the basic build steps.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
@aws-cdk/aws-iam Related to AWS Identity and Access Management effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

3 participants