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/aws-iam: concrete role/group/user ARN does not include path #13156

Closed
saltman424 opened this issue Feb 19, 2021 · 3 comments
Closed
Labels
@aws-cdk/aws-iam Related to AWS Identity and Access Management bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1

Comments

@saltman424
Copy link
Contributor

IAM groups, users, and roles do not have the path included in their cross-environment ARN (i.e. in the getResourceArnAttribute's second argument)

Reproduction Steps

  1. Create stacks for different accounts
  2. Put a role in one stack
  3. Put a bucket in the other
  4. Call stackB.bucket.grantReadWrite(stackA.role)
  5. Try to deploy - should encounter invalid ARN error, e.g. "An ARN in the specified key policy is invalid."

What did you expect to happen?

Correct ARN

What actually happened?

Invalid ARN error

Environment

  • CDK CLI Version : 1.89.0
  • Framework Version: 1.89.0
  • Node.js Version: 12.18.2
  • OS : Windows 10
  • Language (Version): TypeScript 4.1.3

Other

I tried creating a pull request, since this is a quick fix. However, I am having problems with pushing to GitHub.

This was basically my solution (also applied to group and user):

this.roleArn = this.getResourceArnAttribute(role.attrArn, {
  region: '', // IAM is global in each partition
  service: 'iam',
  resource: `role${props.path || '/'}${this.physicalName}`,
});

This is 🐛 Bug Report

@saltman424 saltman424 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 19, 2021
@github-actions github-actions bot added the @aws-cdk/aws-iam Related to AWS Identity and Access Management label Feb 19, 2021
@rix0rrr
Copy link
Contributor

rix0rrr commented Feb 24, 2021

However, I am having problems with pushing to GitHub.

Thanks for the PR!

You need to fork the repository to your own account first. Then you can push to your own account, and create a PR based off of that back to us.

@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1 labels Feb 24, 2021
@saltman424
Copy link
Contributor Author

saltman424 commented Feb 24, 2021

@rix0rrr Turns out it was a credential helper issue for pushing. I just created the pull request: #13258

@ryparker ryparker removed the needs-triage This issue or PR still needs to be triaged. label Jun 2, 2021
mergify bot pushed a commit that referenced this issue Apr 13, 2022
Solution to #13156 


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
StevePotter pushed a commit to StevePotter/aws-cdk that referenced this issue Apr 27, 2022
Solution to aws#13156 


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-iam Related to AWS Identity and Access Management bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1
Projects
None yet
Development

No branches or pull requests

3 participants