Merge bitcoin-core/gui#955: qt: filter addhdkey from RPC console history
What changed, and why it matters
This update stops the Bitcoin Core graphical wallet from remembering the command-line arguments of a sensitive command called addhdkey. Previously, if a user typed addhdkey followed by their extended private key or recovery phrase into the built-in RPC console, that secret material would be saved in the console's command history. Other secret-handling commands were already filtered, but addhdkey was missed. The fix adds it to the same filter and includes a test that confirms the arguments are replaced with a redacted placeholder.
No immediate action required for users; the fix is included in this merge. Users concerned about prior exposure should clear their local Bitcoin Core Qt RPC console history and avoid entering extended private keys or mnemonic phrases into shared or untrusted environments. Developers should verify the same filter is applied to any future RPCs accepting seed or extended-key material.
Security signals we found
Sensitive data exposure via command history
Missing entry in sensitive-command allowlist/filter
Private key / seed phrase material retained in UI history
Consistency fix aligning addhdkey with existing private-key RPC filtering
Evidence from the diff
The commit adds ‘addhdkey’ to the historyFilter QStringList in src/qt/rpcconsole.cpp, which controls which RPC commands have their arguments stripped before being recorded in the Qt RPC console history. It also adds a unit test in src/qt/test/rpcnestedtests.cpp asserting that ‘addhdkey abc’ is filtered to ‘addhdkey(…)’, matching existing behavior for createwallet, createwalletdescriptor, migratewallet, etc. The change is purely defensive and local to the GUI console history logging path.
Changed components
Bitcoin Core Qt GUI RPC consolesrc/qt/rpcconsole.cpp historyFiltersrc/qt/test/rpcnestedtests.cppInspect captured patch +3 / −0
### src/qt/rpcconsole.cpp
@@ -73,6 +73,7 @@ namespace {
// don't add private key handling cmd's to the history
const QStringList historyFilter = QStringList()
+ << "addhdkey"
<< "createwallet"
<< "createwalletdescriptor"
<< "migratewallet"
### src/qt/test/rpcnestedtests.cpp
@@ -85,6 +85,8 @@ void RPCNestedTests::rpcNestedTests()
QVERIFY(result == "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b");
QVERIFY(filtered == "getblock(getbestblockhash())[tx][0]");
+ RPCConsole::RPCParseCommandLine(nullptr, result, "addhdkey abc", /*fExecute=*/false, &filtered);
+ QVERIFY(filtered == "addhdkey(…)");
RPCConsole::RPCParseCommandLine(nullptr, result, "createwallet test true", false, &filtered);
QVERIFY(filtered == "createwallet(…)");
RPCConsole::RPCParseCommandLine(nullptr, result, "createwalletdescriptor abc", false, &filtered);Why this scored 51/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.