-
Notifications
You must be signed in to change notification settings - Fork 16
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
client: add support for password via environment variable #255
base: master
Are you sure you want to change the base?
Conversation
Allow setting password through KEYMASTER_PASSWORD environment variable instead of interactive prompt for keymaster CLI. This aligns with other security tools like Vault CLI (VAULT_TOKEN) for automation scenarios.
I'm not sure that it's a good idea to make it easier to use a password manager. We want people to type their passwords, since this protects against a compromise of the password manager. |
Complicated passwords are generally in a password manager. This would allow one to skip the copy/paste which can be snooped or swiped from the clipboard. Feels safer to use the vault cli best practice IMHO. Is there a middle ground? |
I am also not convinced of this PR. Even Mitre has a CWE-526 for this. However given that you took the time to write a patch I am interested on your specific use case. From your comments it seems like are using some other cli tool to fetch the password. From some tool, is this vault-cli? if so how are you authenticating to the vault. If something else: can you tell us? Also is the use case humans or automation? top of my head (as brainstrom) : Maybe have an option to make the cli call another cli tool? maybe support other authentication schemes? |
I am not the author or know their needs.
Looks like the author is using the 1password cli (op). I've used Bitwarden cli (bw) and Lastpass cli (lpass) for storing and pulling creds before.
Not a bad option. |
Thank you all for the thoughtful feedback and security considerations. Let me clarify the use case: This PR adds an option to use environment variable while still keeping the existing workflow for those who prefer to type password interactively. It supports automated scenarios, and integration with password manager is just one of them. For context, many infrastructure engineers interact with multiple security tools daily across different environments (prod/staging/etc.). This pattern of using environment variables for secure credentials is well-established across the infrastructure ecosystem:
Having to type complex passwords multiple times daily leads to several risks:
However, I understand the concerns about password manager compromise and CWE-526, especially when introducing new authentication methods. @cviecco's suggestion about direct CLI tool integration offers a more controlled approach. Instead of environment variables, we could:
Would this alternative approach better address the security concerns while still enabling secure automation for daily operations? |
Passing the password over a pipe is much better, yes. |
@rgooch Thank you for the feedback regarding U2F security considerations. It was a good idea - having a non-interactive way to provide passwords while maintaining strong security controls. I've revised the approach to focus on security while enabling automation:
This ensures that even in automation scenarios, we maintain the security benefit of physical token verification. I've implemented these changes in a new PR: #256 |
Allow setting password through KEYMASTER_PASSWORD environment variable instead of interactive prompt for keymaster CLI.
This pattern aligns with other security tools like Vault CLI (VAULT_TOKEN) and maintains security best practices while enabling automation scenarios.
Hint: This also enables seamless integration with secret management tools like 1password:
Example workflow:
Changes: