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

Credentials field name is wrong #2797

Closed
2 of 3 tasks
mehiatt opened this issue Sep 18, 2024 · 2 comments
Closed
2 of 3 tasks

Credentials field name is wrong #2797

mehiatt opened this issue Sep 18, 2024 · 2 comments

Comments

@mehiatt
Copy link

mehiatt commented Sep 18, 2024

Acknowledgements

Describe the bug

If you try to use aws.Credentials type with an incoming assume role request, it doesn't map the values correctly because it uses "Expires" vs "Expiration"

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

If the other match, it seems like the expiration date field should also. While this may not be the standard use case, I see a few points with the AWS GoV2 that could benefit from this as well. Maintaining names would also help people when they go though AWS docs and code examples.

Current Behavior

Tldr: It seems like is Expiration either omitted or misspelled in Credentials type.

Reproduction Steps

To reproduce:

type AwsCredentials struct {
Credentials aws.Credentials
}

Have the above type and then the following code (omitting if err != nil { statements for readability) :

req, err := http.NewRequest("GET", "https://"+our creds endpoint+"/role-aliases/"+role name here+"/credentials", nil)     // make req

req.Header.Add("x-amzn-iot-thingname", deviceName)            //add header
res, err := httpClient.Do(req)                                //do request
defer res.Body.Close()

awsCreds := &types.AwsCredentials{}                           // using Credentials Type here to init
json.NewDecoder(res.Body).Decode(awsCreds)                    // decoding with that type

Now if you print out awsCreds, it returns 0001-01-01T00:00:00Z for Expires - I am assuming the default go time object.
All the other fields in Credentials match the response names ->

AccessKeyID = AccessKeyId (case is technically slightly off here, but the values still map correctly)
SessionToken = SessionToken
SecretAccessKey = SecretAccessKey

Possible Solution

No response

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

latest

Compiler and Version used

1.19

Operating System and version

ubuntu 22.04

@mehiatt mehiatt added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 18, 2024
@lucix-aws lucix-aws removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 18, 2024
@lucix-aws
Copy link
Contributor

We can't change the name of a field in a public API just for the sake of having these field names match up like this. The nomenclature here across AWS is generally inconsistent, some APIs use Expires, others use Expiration. If you want to deserialize some credentials value, you'll need to write logic to handle the mapping.

@lucix-aws lucix-aws closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2024
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

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