Page MenuHomePhabricator

rpcauth: Improve by using argparse and getpass modules
ClosedPublic

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

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Commits
rABC03b30a8c3682: rpcauth: Improve by using argparse and getpass modules
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.

Event Timeline

Fabien created this revision.Wed, Jul 31, 09:39
Herald added a reviewer: Restricted Project. · View Herald TranscriptWed, Jul 31, 09:39
deadalnix accepted this revision.Thu, Aug 1, 06:19
This revision is now accepted and ready to land.Thu, Aug 1, 06:19