aws-sdk-go-v2: ParseInt Error with role duration seconds key
Confirm by changing [ ] to [x] below to ensure that it’s a bug:
- I’ve gone though the API reference
- I’ve checked AWS Forums and StackOverflow for answers
- I’ve searched for previous similar issues and didn’t find any solution
Describe the bug Unable to use configured roles due to parsing error of duration_seconds
When instiating an aws client (s3 in my case), the aws go v2 sdk is trying to parse my local roles duration_seconds (28800) and throwing a parse int error exception:
error merging role duration seconds key, strconv.ParseInt: parsing "炀": invalid syntax
Checking out the SDK locally and running the tests reproduces this issue:
> cd config
> go build .
> go test .
2021/03/25 11:01:53 http: TLS handshake error from 127.0.0.1:49463: remote error: tls: bad certificate
--- FAIL: TestResolveLogger (0.00s)
resolve_test.go:206: expect no error, got error merging role duration seconds key, strconv.ParseInt: parsing "炀": invalid syntax
FAIL
FAIL github.com/aws/aws-sdk-go-v2/config 0.805s
FAIL
> go version
go version go1.15.2 darwin/amd64
Version of AWS SDK for Go? aws-sdk-go-v2 1.3.0
Version of Go (go version
)?
1.15.2
Update: Occurs on go1.15.10 too
To Reproduce (observed behavior) Have a configured local aws profile with duration_seconds e.g:
[staging]
role_arn = arn:aws:iam::WHATEVER
mfa_serial = arn:aws:iam::WHATEVER
source_profile = aSourceProfile
duration_seconds = 28800
Run the sdk unit tests
Expected behavior No error occurs, duration_seconds correctly applied to client config
Additional context
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 27 (12 by maintainers)
Commits related to this issue
- #1192 - Fix shared config loading of Duration Seconds from roles to use raw instead of int64 — committed to Zeouterlimits/aws-sdk-go-v2 by deleted user 3 years ago
- config: Fix bug in SDK's merging of duration_seconds shared config Fixes the SDK's handling of `duration_sections` in the shared credentials file or specified in multiple shared config and shared cre... — committed to jasdel/aws-sdk-go-v2 by jasdel 2 years ago
- config: Fix bug in SDK's merging of duration_seconds shared config (#1568) Fixes the SDK's handling of `duration_sections` in the shared credentials file or specified in multiple shared config and s... — committed to aws/aws-sdk-go-v2 by jasdel 2 years ago
- config: Fix bug in SDK's merging of duration_seconds shared config (#1568) Fixes the SDK's handling of `duration_sections` in the shared credentials file or specified in multiple shared config and s... — committed to jrichard8/aws-sdk-go-v2 by jasdel 2 years ago
Good find. i was able to reproduce this via unit test.
Looks like the actual root issue is that
NewIntValue
is trying to convert the integer to a rune which is wrong. It should first convert the integer to a string, then convert the string to a rune slice.The value needs to be a
ini.Value
so it can be merged into the destination viaUpdateValue
I’ll get a fixed and included in PR https://github.com/aws/aws-sdk-go-v2/pull/1568