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

simple bug and am close (hopefully 😁) to making PR: login command hangs if profile doesn't exist #545

Closed
3 tasks done
matthewliuswims opened this issue Mar 25, 2020 · 6 comments
Milestone

Comments

@matthewliuswims
Copy link
Contributor

  • I am using the latest release of AWS Vault
  • I have provided my .aws/config (redacted if necessary)
  • I have provided the debug output using aws-vault --debug (redacted if necessary)

bug/replication

aws-vault login <non-existent-profile> hangs forever if profile doesn't exist 😓

fix attempt

I did some digging: the hang is caused by infinite recursion here

aws-vault/vault/vault.go

Lines 220 to 231 in 1ce3655

func MasterCredentialsFor(profileName string, keyring *CredentialKeyring, config *Config) (string, error) {
hasMasterCreds, err := keyring.Has(profileName)
if err != nil {
return "", err
}
if hasMasterCreds {
return profileName, nil
}
return MasterCredentialsFor(config.SourceProfileName, keyring, config)
}

hasMasterCreds, err := keyring.Has(profileName)  // the culprit
// hasMasterCreds, err end up being false and nil respectively forever and ever

func is called here

aws-vault/vault/vault.go

Lines 196 to 197 in 1ce3655

func NewFederationTokenCredentials(profileName string, k *CredentialKeyring, config *Config) (*credentials.Credentials, error) {
credentialsName, err := MasterCredentialsFor(profileName, k, config)

I'm happy to make a pr, but i'm not sure what kind of base case checking I should be doing for MasterCredentialsFor func without breaking functionality

Thank you!

@mtibben
Copy link
Member

mtibben commented Apr 16, 2020

A PR would certainly be welcome! Get something going and we can discuss

@mtibben mtibben added this to the v6 milestone May 1, 2020
@mtibben
Copy link
Member

mtibben commented May 1, 2020

How's that PR coming along @matthewliuswims? :)

@mtibben
Copy link
Member

mtibben commented May 1, 2020

Possible solution here? #507 (comment)

@matthewliuswims
Copy link
Contributor Author

ah yes - that looks like a great fix. :) gonna do some testing and i'll hopefully put in a PR today!

@matthewliuswims
Copy link
Contributor Author

@mtibben
Copy link
Member

mtibben commented May 2, 2020

Fixed in 1496990

@mtibben mtibben closed this as completed May 2, 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

No branches or pull requests

2 participants