Ask for the passphrase on the controlling terminal, not stdin (closes #144)
check / check (push) Waiting to run
check / check (push) Waiting to run
The passphrase and mnemonic prompts open /dev/tty and ask there, so `echo v | secret add s1 --force`, `secret encrypt` and `secret decrypt` with piped input ask at a terminal instead of failing. Only a process with no controlling terminal still gets the error naming the variable to set. `secret init` and `secret vault create` no longer write a newline to stderr after the mnemonic. On SIGINT or SIGTERM, Entry() restores the settings of /dev/tty instead of stdin, since that is where the prompt turns echo off. The two tests that pin the no-terminal message run the binary in a new session, so it has no terminal wherever the tests run. Unverified by a test: the echo restore after Ctrl-C, checked by hand. Model: opus-5-5
This commit was merged in pull request #165.
This commit is contained in:
@@ -381,6 +381,11 @@ which every command except `secret vault import` offers when the variable is not
|
||||
set, is the safer default; `secret vault import` has no prompt and needs both
|
||||
variables.
|
||||
|
||||
The prompt asks on the terminal the command runs in, not on stdin, so it also
|
||||
asks when stdin is a pipe, as in `echo value | secret add name --force` or
|
||||
`cat file | secret encrypt key`. With no controlling terminal, as under cron or
|
||||
in a CI job, the command fails and names the variable to set.
|
||||
|
||||
## Security Features
|
||||
|
||||
### Encryption
|
||||
|
||||
Reference in New Issue
Block a user