File tree Expand file tree Collapse file tree 2 files changed +16
-11
lines changed
Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -63,14 +63,28 @@ const struct {
6363 {NULL , NULL }
6464};
6565
66+ namespace {
67+
6668// don't add private key handling cmd's to the history
67- const QStringList RPCConsole:: historyFilter = QStringList()
69+ const QStringList historyFilter = QStringList()
6870 << " importprivkey"
6971 << " signrawtransaction"
7072 << " walletpassphrase"
7173 << " walletpassphrasechange"
7274 << " encryptwallet" ;
7375
76+ bool command_may_contain_sensitive_data (const QString cmd)
77+ {
78+ Q_FOREACH (QString unallowedCmd, historyFilter) {
79+ if (cmd.trimmed ().startsWith (unallowedCmd)) {
80+ return true ;
81+ }
82+ }
83+ return false ;
84+ }
85+
86+ }
87+
7488/* Object for executing console RPC commands in a separate thread.
7589*/
7690class RPCExecutor : public QObject
@@ -764,15 +778,7 @@ void RPCConsole::on_lineEdit_returnPressed()
764778 message (CMD_REQUEST, cmd);
765779 Q_EMIT cmdRequest (cmd);
766780
767- bool storeHistory = true ;
768- Q_FOREACH (QString unallowedCmd, historyFilter)
769- {
770- if (cmd.trimmed ().startsWith (unallowedCmd))
771- {
772- storeHistory = false ;
773- break ;
774- }
775- }
781+ bool storeHistory = !command_may_contain_sensitive_data (cmd);
776782
777783 if (storeHistory)
778784 {
Original file line number Diff line number Diff line change @@ -140,7 +140,6 @@ public Q_SLOTS:
140140 ClientModel *clientModel;
141141 QStringList history;
142142 int historyPtr;
143- const static QStringList historyFilter;
144143 QString cmdBeforeBrowsing;
145144 QList<NodeId> cachedNodeids;
146145 const PlatformStyle *platformStyle;
You can’t perform that action at this time.
0 commit comments