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

Config parser doesn't support quotes/spaces in credential_process #1039

Open
digitalcora opened this issue Mar 8, 2024 · 0 comments
Open

Comments

@digitalcora
Copy link

I use 1Password to store my AWS credentials, and initially set up my ~/.aws/config like this:

# https://tenmilesquare.com/resources/security/how-to-use-1password-to-securely-store-your-aws-credentials/

[default]
region = us-east-1
credential_process = "/home/me/.aws/op-cred-helper.sh" "Vault" "AWS Access Key"

This works perfectly with the AWS CLI. However, it doesn't work with ExAWS (using configparser_ex), since it only splits the value of credential_process on whitespace without understanding quoted values. The resulting function call looks like:

System.cmd(
  "\"/home/me/.aws/op-cred-helper.sh\"", ["\"Vault\"", "\"AWS", "Access", "Key\""],
  [stderr_to_stdout: true]
)

...which throws an ENOENT since there is no such file as "/home/me/.aws/op-cred-helper.sh" (quotes included!). As a workaround I can remove all the quotes, but then there cannot be spaces anywhere in the file path, vault name, or item name, otherwise the command isn't constructed correctly. (Fortunately 1Password allows referring to vaults/items using unique IDs that don't contain spaces, so this is only a real problem if the file path contains a space.)

credentials_process is documented to support quoted paths/arguments here: https://docs.aws.amazon.com/sdkref/latest/guide/feature-process-credentials.html

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

1 participant