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

AssumeRole parse response properly #281

Merged
merged 1 commit into from
Feb 12, 2021

Conversation

mattBrzezinski
Copy link
Member

Problem

We are seeing the following error on our CI machines:

ERROR: LoadError: InitError: KeyError: key "Credentials" not found
Stacktrace:
 [1] getindex(::OrderedCollections.LittleDict{Union{String, Symbol},Any,Array{Union{String, Symbol},1},Array{Any,1}}, ::String) at ./abstractdict.jl:492
 [2] _aws_get_role(::String, ::IniFile.Inifile) at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWSCredentials.jl:565
 [3] dot_aws_config(::Nothing) at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWSCredentials.jl:449
 [4] (::AWS.var"#12#15")() at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWSCredentials.jl:154
 [5] AWS.AWSCredentials(; profile::Nothing) at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWSCredentials.jl:163
 [6] AWS.AWSConfig() at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWSConfig.jl:18
 [7] #global_aws_config#21 at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWS.jl:47 [inlined]
 [8] global_aws_config at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWS.jl:46 [inlined]
 [9] AWSS3.S3Path(::String) at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWSS3/H9WJU/src/s3path.jl:83
 [10] init(::Type{{REDACTED}.{REDACTED}}) at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/{REDACTED}/p9Xwj/src/{REDACTED}.jl:74
 [11] __init__() at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/{REDACTED}/p9Xwj/src/{REDACTED}.jl:24
 [12] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:697
 [13] _require_from_serialized(::String) at ./loading.jl:749
 [14] _require(::Base.PkgId) at ./loading.jl:1040
 [15] require(::Base.PkgId) at ./loading.jl:928
 [16] require(::Module, ::Symbol) at ./loading.jl:923
 [17] include(::String) at ./client.jl:457
 [18] top-level scope at none:6
during initialization of module {REDACTED}

Solution

AWS does not return the credentials when assuming a role at the top-level, but instead it's nested in the AssumeRoleResult key.

Copy link

@morris25 morris25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Is there a test we can add for this?

@@ -562,13 +562,13 @@ function _aws_get_role(role::AbstractString, ini::Inifile)
aws_config=config
)

role_creds = role["Credentials"]
role_creds = role["AssumeRoleResult"]["Credentials"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there some docs that we can link to that keep track of what format this takes?

Copy link
Member Author

@mattBrzezinski mattBrzezinski Feb 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattBrzezinski
Copy link
Member Author

LGTM! Is there a test we can add for this?

Yes, I can add in a test for this will need to update the stack as well. I'll get up a commit shortly.

@mattBrzezinski
Copy link
Member Author

LGTM! Is there a test we can add for this?

Ran into some issues when creating a test for this, currently don't have the time to look into it. I think this should go in to un-block our private CI's running into issues.

#282

@mattBrzezinski
Copy link
Member Author

bors r+

bors bot added a commit that referenced this pull request Feb 12, 2021
281: AssumeRole parse response properly r=mattBrzezinski a=mattBrzezinski

# Problem
We are seeing the following error on our CI machines:

```julia
ERROR: LoadError: InitError: KeyError: key "Credentials" not found
Stacktrace:
 [1] getindex(::OrderedCollections.LittleDict{Union{String, Symbol},Any,Array{Union{String, Symbol},1},Array{Any,1}}, ::String) at ./abstractdict.jl:492
 [2] _aws_get_role(::String, ::IniFile.Inifile) at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWSCredentials.jl:565
 [3] dot_aws_config(::Nothing) at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWSCredentials.jl:449
 [4] (::AWS.var"#12#15")() at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWSCredentials.jl:154
 [5] AWS.AWSCredentials(; profile::Nothing) at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWSCredentials.jl:163
 [6] AWS.AWSConfig() at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWSConfig.jl:18
 [7] #global_aws_config#21 at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWS.jl:47 [inlined]
 [8] global_aws_config at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWS/SALZq/src/AWS.jl:46 [inlined]
 [9] AWSS3.S3Path(::String) at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/AWSS3/H9WJU/src/s3path.jl:83
 [10] init(::Type{{REDACTED}.{REDACTED}}) at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/{REDACTED}/p9Xwj/src/{REDACTED}.jl:74
 [11] __init__() at /Users/admin/builds/f75a2375/0/invenia/{REDACTED}.jl.tmp/depot/packages/{REDACTED}/p9Xwj/src/{REDACTED}.jl:24
 [12] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:697
 [13] _require_from_serialized(::String) at ./loading.jl:749
 [14] _require(::Base.PkgId) at ./loading.jl:1040
 [15] require(::Base.PkgId) at ./loading.jl:928
 [16] require(::Module, ::Symbol) at ./loading.jl:923
 [17] include(::String) at ./client.jl:457
 [18] top-level scope at none:6
during initialization of module {REDACTED}
```

# Solution
AWS does not return the credentials when assuming a role at the top-level, but instead it's nested in the `AssumeRoleResult` key.

Co-authored-by: Matt Brzezinski <[email protected]>
@mattBrzezinski
Copy link
Member Author

Logged an issue for the bors callback to merge not working, #283
Tests are passing though, I'll manually merge.

@mattBrzezinski mattBrzezinski merged commit f7b0d85 into master Feb 12, 2021
@mattBrzezinski mattBrzezinski deleted the MB/right-proper-role-parse branch February 12, 2021 16:32
@iamed2
Copy link
Member

iamed2 commented Feb 12, 2021

@mattBrzezinski can you add a test with @test_skip and a comment?

@mattBrzezinski
Copy link
Member Author

@mattBrzezinski can you add a test with @test_skip and a comment?

I do actually want to dig into this at some point as I'm really curious why this isn't working.
Since it's already merged in I don't see much value in adding in the test, just to skip over it.

@bors
Copy link
Contributor

bors bot commented Feb 12, 2021

Timed out.

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

Successfully merging this pull request may close these issues.

3 participants