fpco / amber

Manage secret values in-repo via public key cryptography
MIT License
86 stars 9 forks source link

encrypt: take secret value from stdin #15

Closed justinfenn closed 3 years ago

justinfenn commented 3 years ago

Could the encrypt subcommand take the secret value from stdin? This would help prevent raw secrets from being saved in shell history, for example.

BTW, this is a very cool project! It hits a lot of sweet spots for in-repo secret storage.

snoyberg commented 3 years ago

This sounds like a good addition. I can think of three different ways of implementing it:

  1. Make the value optional for the encrypt command, and when absent, pulls the data from stdin.
  2. Use a special value of - to tell Amber "grab the data from stdin"
  3. Add a separate subcommand that explicitly says "grab data from stdin"

Problems with each of these that I see:

  1. Users may be surprised that amber encrypt FOO seems to work but does nothing
  2. If someone actually wants to encrypt - for some reason, they can't (without extra workarounds)
  3. Adding extra subcommands makes the interface larger and more unwieldy

Overall I'm leaning towards (1). Any thoughts?

BTW, this is a very cool project! It hits a lot of sweet spots for in-repo secret storage.

Thank you!

justinfenn commented 3 years ago

I think 1 sounds good. If it prompts the user with something like "Secret value: " then it hopefully won't be too surprising. And it should still work if stdin is redirected to a file or something.