The passphrase prompt reads stdin, so secret add --force with a piped value and secret encrypt/decrypt from stdin cannot ask for the passphrase
#144
Reference in New Issue
Block a user
Severity: major. The documented way to give a value,
echo value | secret add name, fails as soon as the command needs the long-term key, and the only way out isSB_UNLOCK_PASSPHRASE, which the README warns against.What happens.
readFromTerminalrefuses when stdin is not a terminal and otherwise reads the passphrase from stdin. A firstaddneeds only the public key, but--forcesetsnotAfteron the previous version, which needs the long-term key;encryptanddecryptneed the key secret decrypted.Where.
--force);Correct behaviour. The README's
--forcesays "Overwrite existing secret" with no condition, andsecret encryptsays input is stdin by default. Recommended: prompt on the controlling terminal (/dev/tty), as gpg, ssh and sudo do, and keep the current error only when there is none.Definition of done
echo v | secret add s1 --forceat a terminal asks for the passphrase and succeeds.cat file | secret encrypt keyandcat file.age | secret decrypt keyask and succeed.Model: fable-5-1