Skip to content

Commit

Permalink
Fix infinite recursion issue for missing/invalid profile
Browse files Browse the repository at this point in the history
Fixes #575 #545
  • Loading branch information
matthewliuswims authored and mtibben committed May 2, 2020
1 parent 2386d86 commit 1496990
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,10 @@ The [macOS release builds](https://github.com/99designs/aws-vault/releases) are

$ codesign --verify --verbose $(which aws-vault)

If you are developing or compiling the aws-vault binary yourself, you can [generate a self-signed certificate](https://support.apple.com/en-au/guide/keychain-access/kyca8916/mac) by accessing Keychain Access > Certificate Assistant > Create Certificate > Code Signing Certificate. You can then sign your binary with:
If you are developing or compiling the aws-vault binary yourself, you can [generate a self-signed certificate](https://support.apple.com/en-au/guide/keychain-access/kyca8916/mac) by accessing Keychain Access > Certificate Assistant > Create Certificate -> Certificate Type: Code Signing. You can then sign your binary with:

$ go build .
$ codesign --sign "Name of my certificate" ./aws-vault

$ codesign --sign <Name of certificate created above> ./aws-vault

## References and Inspiration

Expand Down
2 changes: 1 addition & 1 deletion cli/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func LoginCommand(input LoginCommandInput, configLoader *vault.ConfigLoader, key
creds, err = vault.NewFederationTokenCredentials(input.ProfileName, ckr, config)
}
if err != nil {
return err
return fmt.Errorf("profile %s: %w", input.ProfileName, err)
}

val, err := creds.Get()
Expand Down
4 changes: 4 additions & 0 deletions vault/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,9 @@ func MasterCredentialsFor(profileName string, keyring *CredentialKeyring, config
return profileName, nil
}

if profileName == config.SourceProfileName {
return "", fmt.Errorf("No master credentials found")
}

return MasterCredentialsFor(config.SourceProfileName, keyring, config)
}

0 comments on commit 1496990

Please sign in to comment.