aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonas Schnelli <jonas.schnelli@include7.ch>2015-03-13 21:51:27 +0100
committerLuke Dashjr <luke-jr+git@utopios.org>2016-12-29 11:43:28 +0000
commit9044908636f0072d001d9a029053a384127b002b (patch)
treeb222ea5dc55ec50a39ec5ddb1563c69ded8486a6 /src
parentfc95daa97f324f6a8b3643a3d3c5e8f909d46c35 (diff)
Qt/RPCConsole: Don't store commands with potentially sensitive information in the history
Filters importprivkey, signrawtransaction, walletpassphrase, walletpassphrasechange, and encryptwallet
Diffstat (limited to 'src')
-rw-r--r--src/qt/rpcconsole.cpp37
-rw-r--r--src/qt/rpcconsole.h1
2 files changed, 29 insertions, 9 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 5610e8b6ca..562c9509da 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -63,6 +63,14 @@ const struct {
{NULL, NULL}
};
+// don't add private key handling cmd's to the history
+const QStringList RPCConsole::historyFilter = QStringList()
+ << "importprivkey"
+ << "signrawtransaction"
+ << "walletpassphrase"
+ << "walletpassphrasechange"
+ << "encryptwallet";
+
/* Object for executing console RPC commands in a separate thread.
*/
class RPCExecutor : public QObject
@@ -755,15 +763,26 @@ void RPCConsole::on_lineEdit_returnPressed()
message(CMD_REQUEST, cmd);
Q_EMIT cmdRequest(cmd);
- // Remove command, if already in history
- history.removeOne(cmd);
- // Append command to history
- history.append(cmd);
- // Enforce maximum history size
- while(history.size() > CONSOLE_HISTORY)
- history.removeFirst();
- // Set pointer to end of history
- historyPtr = history.size();
+
+ bool storeHistory = true;
+ Q_FOREACH(QString unallowedCmd, historyFilter)
+ {
+ if (cmd.trimmed().startsWith(unallowedCmd))
+ storeHistory = false; break;
+ }
+
+ if (storeHistory)
+ {
+ // Remove command, if already in history
+ history.removeOne(cmd);
+ // Append command to history
+ history.append(cmd);
+ // Enforce maximum history size
+ while(history.size() > CONSOLE_HISTORY)
+ history.removeFirst();
+ // Set pointer to end of history
+ historyPtr = history.size();
+ }
// Scroll console view to end
scrollToEnd();
}
diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h
index e1698711da..4841ea825e 100644
--- a/src/qt/rpcconsole.h
+++ b/src/qt/rpcconsole.h
@@ -140,6 +140,7 @@ private:
ClientModel *clientModel;
QStringList history;
int historyPtr;
+ const static QStringList historyFilter;
QString cmdBeforeBrowsing;
QList<NodeId> cachedNodeids;
const PlatformStyle *platformStyle;