forked from qt-creator/qt-creator
Debugger: Suppress putting full environment contents into logs
People are known to put things like passwords into environment variables, and we pass the environment hexencoded to the debugged process, so it might be overlooked when logs passed around. Better not have the data in the log to start with. Change-Id: If93a42a291b8b62c38d01e606cc0e49b8f2e3e95 Reviewed-by: Filipe Azevedo <filipe.azevedo@kdab.com> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -61,6 +61,7 @@
|
||||
#include <QToolTip>
|
||||
#include <QVariant>
|
||||
#include <QJsonArray>
|
||||
#include <QRegularExpression>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Utils;
|
||||
@@ -125,7 +126,10 @@ void LldbEngine::runCommand(const DebuggerCommand &cmd)
|
||||
command.arg("token", tok);
|
||||
QString token = QString::number(tok);
|
||||
QString function = command.function + "(" + command.argsToPython() + ")";
|
||||
showMessage(token + function + '\n', LogInput);
|
||||
QString msg = token + function + '\n';
|
||||
if (cmd.flags == LldbEngine::Silent)
|
||||
msg.replace(QRegularExpression("\"environment\":.[^]]*."), "<environment suppressed>");
|
||||
showMessage(msg, LogInput);
|
||||
m_commandForToken[currentToken()] = command;
|
||||
m_lldbProc.write("script theDumper." + function.toUtf8() + "\n");
|
||||
}
|
||||
@@ -392,6 +396,8 @@ void LldbEngine::setupInferior()
|
||||
notifyInferiorSetupFailed();
|
||||
}
|
||||
};
|
||||
|
||||
cmd2.flags = LldbEngine::Silent;
|
||||
runCommand(cmd2);
|
||||
}
|
||||
|
||||
|
@@ -61,6 +61,12 @@ public:
|
||||
explicit LldbEngine(const DebuggerRunParameters &runParameters);
|
||||
~LldbEngine() override;
|
||||
|
||||
enum LldbCommandFlag {
|
||||
NoFlags = 0,
|
||||
// Do not echo to log.
|
||||
Silent = 1
|
||||
};
|
||||
|
||||
signals:
|
||||
void outputReady(const QString &data);
|
||||
|
||||
|
Reference in New Issue
Block a user