[BUG] --passphrase-file ignored for "chia start"
See original GitHub issueDescribe the bug There are three bugs here, filed as one issue as they are all interrelated:
Bug 1 - Cannot start chia with passphrase-file
When starting Chia, the new --passphrase-file
CLI option has no effect; Chia queries the passphrase from the terminal, preventing unattended system start scripts from operating. Other Chia operations, such as keys show
work as expected.
To Reproduce
(venv) ~$ echo -n "Super Secret" > /tmp/chia.pw
(venv) ~$ chia --passphrase-file /tmp/chia.pw keys show
Showing all public keys derived from your master seed and private key:
Fingerprint: 12345678
...
(venv) ~$ chia --passphrase-file /tmp/chia.pw start farmer
Daemon not started yet
Starting daemon
(Unlock Keyring) Passphrase:
Aborted!
(venv) ~$
Bug 2 - Input sanitizing
The routine that reads the --passphrase-file
preserves spaces within the passphrase (correct) but also includes line termination characters (CRLF) within the passphrase (incorrect).
To Reproduce
(venv) ~$ echo "Super Secret" > /tmp/chia.pw # The correct password but with '\n' on the end.
(venv) ~$ chia --passphrase-file /tmp/chiia.pw keys show
(Unlock Keyring) Passphrase:
Aborted!
(venv) ~$
Bug 3 - Lack of error/abort on incorrect passphrase
When providing the wrong password in the passphrase-file, chia does not abort with an “incorrect passphrase” error. See the “To Reproduce” for Bug 2.
Expected Behavior
Chia should honor --passphrase-file
when starting, and provide useful error output when the passphrase is incorrect.
(venv) ~$ echo "There are no mistakes, just happy accidents" > /tmp/chia.pw
(venv) ~$ chia --passphrase-file /tmp/chia.pw keys show
Invalid passphrase from file /tmp/chia.pw
(venv) ~$ echo $?
1
(venv) ~$ echo $'Super Secret\n\n\r\n\r\n' > /tmp/chia.pw
(venv) ~$ chia --passphrase-file /tmp/chia.pw start farmer
Daemon not started yet
Starting daemon
Starting farmer
...
(venv) ~$
Desktop
- OS: Slackware Linux
- OS Version/Flavor: Current, a.k.a. 15.0
- CPU: AMD Ryzen
- Chia Version: 1.2.11.dev20 (git main HEAD) and/or 1.2.10 (git latest)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top GitHub Comments
Offtopic: I am not a chia developer, but a normal one and this is -by far- one of the best bug descriptions I have ever seen, @moonlitbugs
Fixes have been merged into main.