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

Handle OIDC caching for new keyring entries #631

Merged
merged 2 commits into from Aug 18, 2020

Conversation

ajkerrigan
Copy link
Contributor

@ajkerrigan ajkerrigan commented Aug 18, 2020

I was testing the new OIDC caching in #628 (yay!) and ran into some errors when I had no existing OIDC entry in my keychain.

First, aws-vault would die immediately with:

aws-vault: error: exec: Failed to get credentials for <my-profile>: The specified item could not be found in the keyring

After a tweak to fix that, it would go through most of the normal credential flow but die later:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x45f99f8]

goroutine 6 [running]:
github.com/99designs/aws-vault/v6/vault.(*SSORoleCredentialsProvider).getRoleCredentials(0xc000314100, 0xc00014c000, 0x0, 0x0)
        github.com/99designs/aws-vault/v6/vault/ssorolecredentialsprovider.go:58 +0xf8
...

After erroring out once, I would see the OIDC entry in my keychain and subsequent runs would work as expected.

This PR is a first pass attempt to address both first-run errors. Happy to talk through it or make additional changes as needed.

Avoid erroring out when:

* There is no existing OIDC entry in the keyring
* A new OIDC token has been created and cached
@mtibben
Copy link
Member

mtibben commented Aug 18, 2020

Thanks for the fix @ajkerrigan!

@mtibben mtibben merged commit 5f20470 into 99designs:master Aug 18, 2020
@ajkerrigan
Copy link
Contributor Author

Thanks for the fix @ajkerrigan!

Thanks for catching/fixing the cache check!

@mtibben mtibben added this to the v6 milestone Aug 29, 2020
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.

None yet

2 participants