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.GenerateSTSCredentialsAsync() is ignoring TTL parameter #288

Closed
chiguire opened this issue Dec 5, 2022 · 3 comments
Closed

AWS.GenerateSTSCredentialsAsync() is ignoring TTL parameter #288

chiguire opened this issue Dec 5, 2022 · 3 comments
Assignees
Milestone

Comments

@chiguire
Copy link

chiguire commented Dec 5, 2022

Describe the bug
The generate AWS STS credentials function is ignoring the TTL parameter. Passing a "3600s" ttl will generate a credential with a lease time of 1800 seconds.

VaultSharp Version
1.7.1

Vault Version
1.8.9

Does this work with Vault CLI?
Yes

Sample Code Snippet
var response = vaultClient.V1.Secrets.AWS.GenerateSTSCredentialsAsync(role, $"{ttlSeconds}s");
Console.log($"Lease duration: {response.LeaseDurationSeconds}"); // will log "Lease duration: 1800"

Any additional info
In https://github.com/rajanadar/VaultSharp/blob/master/src/VaultSharp/V1/SecretsEngines/AWS/AWSSecretsEngineProvider.cs the timeToLive parameter is passed to MakeVaultApiRequest() in https://github.com/rajanadar/VaultSharp/blob/master/src/VaultSharp/Core/Polymath.cs as part of the requestData object.

It then passes requestData to
MakeRequestAsync(), where it is converted to requestContent and that variable is only used for POST and PUT requests but this call is a GET. These parameters should be passed as URL parameters in the GET request.

@rajanadar rajanadar self-assigned this Dec 6, 2022
@rajanadar rajanadar added this to the 1.7.3 milestone Dec 6, 2022
@rajanadar
Copy link
Owner

@chiguire Can you please verify with 1.7.2.2 version and let me know?

The Vault team changed the http method to POST from GET, so I made those changes and also added support for role arn, role session name etc.

Let me know if any issues.

@chiguire
Copy link
Author

chiguire commented Dec 9, 2022

I can confirm it works just fine, thanks for the prompt resolution.

@rajanadar
Copy link
Owner

Fantastic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants