Page MenuHomePhabricator

rpcauth: Improve by using argparse and getpass modules
ClosedPublic

Authored by Fabien on Jul 31 2019, 09:39.

Details

Summary
This PR improves argument handling in rpcauth.py script by using
argparse module. Specifying - as password makes it prompt securely with
getpass module which prevents leaking passwords to bash history.

Backport of core PR14756
https://github.com/bitcoin/bitcoin/pull/14756/files

Depends on D3781.

Also updated the copyright so the file is in sync with core.

Test Plan
make check

./share/rpcauth/rpcauth.py foo --help

Check help is displayed correctly.

./share/rpcauth/rpcauth.py foo -

Check the script asks for password.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.