Browse Source

Qt/RPCConsole: Truncate filtered commands to just the command name, rather than skip it entirely in history

0.14
Luke Dashjr 8 years ago
parent
commit
1755c04576
  1. 12
      src/qt/rpcconsole.cpp

12
src/qt/rpcconsole.cpp

@ -74,14 +74,14 @@ const QStringList historyFilter = QStringList() @@ -74,14 +74,14 @@ const QStringList historyFilter = QStringList()
<< "walletpassphrasechange"
<< "encryptwallet";
bool command_may_contain_sensitive_data(const QString cmd)
QString command_filter_sensitive_data(const QString cmd)
{
Q_FOREACH(QString unallowedCmd, historyFilter) {
if (cmd.trimmed().startsWith(unallowedCmd)) {
return true;
return unallowedCmd;
}
}
return false;
return cmd;
}
}
@ -779,10 +779,8 @@ void RPCConsole::on_lineEdit_returnPressed() @@ -779,10 +779,8 @@ void RPCConsole::on_lineEdit_returnPressed()
message(CMD_REQUEST, cmd);
Q_EMIT cmdRequest(cmd);
bool storeHistory = !command_may_contain_sensitive_data(cmd);
cmd = command_filter_sensitive_data(cmd);
if (storeHistory)
{
// Remove command, if already in history
history.removeOne(cmd);
// Append command to history
@ -792,7 +790,7 @@ void RPCConsole::on_lineEdit_returnPressed() @@ -792,7 +790,7 @@ void RPCConsole::on_lineEdit_returnPressed()
history.removeFirst();
// Set pointer to end of history
historyPtr = history.size();
}
// Scroll console view to end
scrollToEnd();
}

Loading…
Cancel
Save