The -stdinwalletpassphrase flag reads the passphrase from stdin with echo disabled, avoiding exposure in shell history and the process list. Add an example of its use to walletpassphrase and walletpassphrasechange so users discover the safer alternative where they need it.
doc: mention -stdinwalletpassphrase in walletpassphrase(change) help #35242
pull isghe wants to merge 1 commits into bitcoin:master from isghe:doc/stdinwalletpassphrase-hint changing 1 files +6 −2-
isghe commented at 1:59 PM on May 8, 2026: contributor
-
cce5f94cef
doc: mention -stdinwalletpassphrase in walletpassphrase(change) help
The -stdinwalletpassphrase flag reads the passphrase from stdin with echo disabled, avoiding exposure in shell history and the process list. Add an example of its use to walletpassphrase and walletpassphrasechange so users discover the safer alternative where they need it.
- DrahtBot added the label Docs on May 8, 2026
-
DrahtBot commented at 1:59 PM on May 8, 2026: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
Code Coverage & Benchmarks
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35242.
<!--021abf342d371248e50ceaed478a90ca-->
Reviews
See the guideline for information on the review process.
Type Reviewers ACK ferminquant, mercie-ux If your review is incorrectly listed, please copy-paste <code><!--meta-tag:bot-skip--></code> into the comment that the bot should ignore.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
-
ferminquant commented at 3:32 PM on May 8, 2026: none
ACK cce5f94cef34a009ad1e8fae1d63806c099c8bd8
Reviewed the diff and checked the bitcoin-cli stdin parsing. Built bitcoind and bitcoin-cli with wallet support via depends, verified the new help output, and tested both examples on regtest with an encrypted wallet.
-
mercie-ux commented at 4:28 AM on May 12, 2026: none
ACK cce5f94 Verified the
-stdinwalletpassphrase -stdin walletpassphrasechangeexample is correct by tracing the flag handling inbitcoin-cli.cpp:-stdinwalletpassphrasereads line 1 from stdin and inserts it asoldpassphrase, then-stdinreads remaining lines and appendsnewpassphrase. Thestarts_with("walletpassphrase")guard confirms both commands are supported. - sedited requested review from polespinasa on Jul 2, 2026
-
in src/wallet/rpc/encrypt.cpp:133 in cce5f94cef
127 | @@ -126,8 +128,10 @@ RPCMethod walletpassphrasechange() 128 | }, 129 | RPCResult{RPCResult::Type::NONE, "", ""}, 130 | RPCExamples{ 131 | - HelpExampleCli("walletpassphrasechange", "\"old one\" \"new one\"") 132 | - + HelpExampleRpc("walletpassphrasechange", "\"old one\", \"new one\"") 133 | + HelpExampleCli("walletpassphrasechange", "\"old one\" \"new one\"") + 134 | + "\nUsing -stdinwalletpassphrase to avoid exposing passphrases in shell history or process list\n" 135 | + + HelpExampleCli("-stdinwalletpassphrase -stdin walletpassphrasechange", "") +
polespinasa commented at 7:18 PM on July 2, 2026:I don't think there is need for using both -stdinwalletpassphrase and -stdin in the case of
walletpassphrasechange. Using only eitherstdinorstdinwalletpassphrasealso worksin src/wallet/rpc/encrypt.cpp:134 in cce5f94cef
127 | @@ -126,8 +128,10 @@ RPCMethod walletpassphrasechange() 128 | }, 129 | RPCResult{RPCResult::Type::NONE, "", ""}, 130 | RPCExamples{ 131 | - HelpExampleCli("walletpassphrasechange", "\"old one\" \"new one\"") 132 | - + HelpExampleRpc("walletpassphrasechange", "\"old one\", \"new one\"") 133 | + HelpExampleCli("walletpassphrasechange", "\"old one\" \"new one\"") + 134 | + "\nUsing -stdinwalletpassphrase to avoid exposing passphrases in shell history or process list\n" 135 | + + HelpExampleCli("-stdinwalletpassphrase -stdin walletpassphrasechange", "") + 136 | + HelpExampleRpc("walletpassphrasechange", "\"old one\", \"new one\"")
polespinasa commented at 7:22 PM on July 2, 2026:The view is bit ugly, worth adding before the
HelpExampleRpc"\nAs a JSON-RPC call\n"polespinasa commented at 7:23 PM on July 2, 2026: memberConcept~0
Idk how useful this will be as examples are incomplete, they miss how to pass the passphrase, and because it can be done in many ways, idk if it is worth adding it. Also I am not sure if
HelpExampleCliwould accept a nonbitcoin-cli commandsedited commented at 12:23 PM on August 4, 2026: contributorI agree with @polespinasa , there is not a whole lot of value from these changes. There's also been no response from the author for over a month. Closing this again.
sedited closed this on Aug 4, 2026isghe commented at 9:25 PM on August 5, 2026: contributorHi everyone,
Sorry for the late reply.
The motivation behind this PR was actually driven by my own experience.
For years I used
walletpassphrasewith the passphrase directly on the command line because I simply wasn't aware that-stdinwalletpassphraseexisted.When I eventually discovered it, I realized that other users could easily make the same mistake and unintentionally expose their wallet passphrase through shell history or process listings.
My intention wasn't simply to add more examples to the help output, but to make this safer usage pattern easier to discover. Even now, I still find it useful to have it documented directly in the command help as a reminder.
I also understand the feedback that the examples could have been clearer about how stdin is used, especially for
walletpassphrasechange.Thank you all for taking the time to review the proposal and for the valuable feedback.
Labels
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-08-23 22:51 UTC
More mirrored repositories can be found on mirror.b10c.me