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

How to set ExternalId when using AWSSDK.Extensions.NETCore.Setup #3286

Closed
ashishdhingra opened this issue Apr 12, 2024 Discussed in #3284 · 3 comments
Closed

How to set ExternalId when using AWSSDK.Extensions.NETCore.Setup #3286

ashishdhingra opened this issue Apr 12, 2024 Discussed in #3284 · 3 comments
Assignees
Labels
Extensions feature-request A feature should be added or improved. p2 This is a standard priority issue queued

Comments

@ashishdhingra
Copy link
Contributor

Discussed in #3284

Originally posted by douggish April 11, 2024
I'm using AWSSDK.Extensions.NETCore.Setup for configuration and need to assume a role in certain cases for cross-account access. I currently have code similar to the following to create a client that assumes a role:

AWSOptions options = _configuration.GetAWSOptions<AmazonLambdaConfig>();
options.SessionRoleArn = roleArn;
options.SessionName = sessionName;

return options.CreateServiceClient<IAmazonLambda>();

However, I can't find how I can set the ExternalId to address the "confused deputy problem" documented here: https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html

I explored creating an AssumeRoleAWSCredentials instance manually (so I could set the AssumeRoleAWSCredentialsOptions myself) with the idea of setting the Credentials property of my AWSOptions object. However, the AssumeRoleAWSCredentials requires sourceCredentials, which I'm not sure how to get from my AWSOptions.

How can I assume a role with ExternalId set when using AWSSDK.Extensions.NETCore.Setup?

@ashishdhingra ashishdhingra added feature-request A feature should be added or improved. module/tools p2 This is a standard priority issue Extensions and removed module/tools labels Apr 12, 2024
@ashishdhingra
Copy link
Contributor Author

The possible fix would be to expose another public property SessionExternalId in AWSOptions. When using SessionRoleArn, the extensions library uses AssumeRoleAWSCredentials where we can pass AssumeRoleAWSCredentialsOptions.ExternalId in overloaded constructor.

@ashishdhingra
Copy link
Contributor Author

Support for ExternalId has been released in AWSSDK.Extensions.NETCore.Setup version 3.7.301.

Copy link

github-actions bot commented Jun 5, 2024

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Extensions feature-request A feature should be added or improved. p2 This is a standard priority issue queued
Projects
None yet
Development

No branches or pull requests

1 participant