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-servicecatalog: giveAccessToRole using wildcards when sharing Principal Names #29770

Open
2 tasks
thpham opened this issue Apr 9, 2024 · 4 comments
Open
2 tasks
Labels
@aws-cdk/aws-servicecatalog Related to AWS Service Catalog effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p3

Comments

@thpham
Copy link

thpham commented Apr 9, 2024

Describe the feature

Allow to share AWS Service Catalog portfolio access with principal names that contains wildcards.
The feature seems to be possible given the following documentation link: https://docs.aws.amazon.com/servicecatalog/latest/adminguide/catalogs_portfolios_sharing_how-to-share.html#principal-name-share

image

image

Use Case

In the context of an AWS Organisation with SSO and multi-account permission set, the provisioned roles in the sub-accounts have an ARN pattern which contains each time a random number suffix (ex.: arn:aws:iam::${accountId}:role/${roleName}_{randomNumber}).

The ability to use giveAccessToRole with a string ARN pattern would allow us to share access to the portfolio across the entire organisation account with the people having the permission set.

Proposed Solution

No response

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

Environment details (OS name and version, etc.)

macos 14

@thpham thpham added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Apr 9, 2024
@github-actions github-actions bot added the @aws-cdk/aws-servicecatalog Related to AWS Service Catalog label Apr 9, 2024
@pahud
Copy link
Contributor

pahud commented Apr 9, 2024

Yes I agree. Can you share a little code snippets about this and what's the desired API experience with some sample?

I am making it a p2 and we welcome any pull requests from the community to move this forward.

@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 Apr 9, 2024
@thpham
Copy link
Author

thpham commented Apr 9, 2024

Hello, thank you very much for your consideration.

I'm not fully familiar with aws-cdk yet, so I hope the community or maintainers to contribute to their perspective.
But I foresee 2 approach for this:

  1. we keep the signature of giveAccessToRole(role: iam.IRole) function, and we allow to instantiate a Role with an ARN pattern that allow wildcard pattern, also in regard to its validation.
  2. or we create another function for ex. giveAccessToIamPrincipalARN(arn: string): void.

I tend to prefer the option 2, because it is closer to the actual use case and current UI capability.
But I might also understand that the case might be also useful in other generalisable situation that cover the option 1 (I dont have any example in mind at the moment).

Dear community, please share your opinion to help maintainers get a direction for the implementation. Thank you.

@avoidik
Copy link

avoidik commented Aug 28, 2024

Just an opinion.

For the context, the AWS ServiceCatalog experience includes two general parts:
A. product ownership -- a person or a team which is responsible for the complete life-cycle of products being distributed through a Service Catalog portfolio
B. customer-facing -- which is consuming products shared by the product owner

Having this A-B relation model in mind here's a use-case. An actor representing the B part would like to provision a ServiceCatalog product from the ServiceCatalog portfolio, which is in turn protected by the ServiceCatalog portfolio grants (it's not possible to access the portfolio without this grant). To control the grants the product owner actor should use AssociatePrincipalWithPortfolio and DisassociatePrincipalFromPortfolio ServiceCatalog API methods. The product owner can supply here a very specific IAM principal ARN (corresponding to PrincipalType.IAM), or a IAM principal pattern with no account id in it (corresponding to PrincipalType.IAM_PATTERN). The product owner is enlisting the most obvious IAM principals, like AWS SSO roles. On the other hand, the customer can use different options to provision the product: [1] by using their own IAM principal identity, [2] by using any kind of IAM delegated identity. In the first case scenario, it's relatively easy for the product owner actor to identify which IAM principal to use, and then enlist it as PrincipalType.IAM (for example SSO roles). However in the second case scenario it is not always easy, for example if the customer is using the aws_servicecatalog.CfnCloudFormationProvisionedProduct construct in CDK, it assumes IAM roles named as cdk-{qualifier}-{purpose}-{account_id}-{region} in attempt to access the ServiceCatalog portfolio, and then fails because the grants list has only SSO roles in it. It's okay to enlist these special CDK IAM roles for one particular AWS account, but what if we have plenty of AWS accounts? The IAM pattern matching grants come in handy. The list of the grants in question can have up to 10 entries, so that the IAM pattern matching option could be considered as an option to relax the constraint.

In my opinion, the 2nd option with giveAccessToIamPrincipalARN(arn: string) can potentially fulfil this gap.

@avoidik
Copy link

avoidik commented Aug 28, 2024

xref. #24370, #25956

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-servicecatalog Related to AWS Service Catalog effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p3
Projects
None yet
Development

No branches or pull requests

3 participants