99designs / aws-vault

A vault for securely storing and accessing AWS credentials in development environments
MIT License
8.53k stars 822 forks source link

Using `exec` with invalid profile name does not error #1248

Open pjroth opened 4 months ago

pjroth commented 4 months ago

If I use a profile name that doesn't exist in my ~/.aws/config file (note I do not have a ~/.aws/credentials file), aws-vault does not error and gives me credentials. Here is an example (I hid the actual AWS credentials via the grep but they are indeed set on the shell):

❯ aws-vault exec invalid-profile-name -- env |grep AWS_VAULT
AWS_VAULT=invalid-profile-name

Expected behavior: I would expect aws-vault to error (return non-zero code to the shell) along with a useful error message since I provided an invalid profile name. This expected behavior is similar to what AWS CLI does. For example, the AWS CLI provides a useful error message when given an invalid profile as follows:

❯ AWS_PROFILE=invalid-profile-name aws s3 ls

The config profile (invalid-profile-name) could not be found