diff options
author | hjk <hjk@qt.io> | 2016-12-06 16:06:08 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2016-12-07 07:40:33 +0000 |
commit | f1a05dfb35eaf8a24b67d8b018b957aba12a8c4e (patch) | |
tree | b625e589c7f5ae582484c7de8c4972a0b8f828a5 | |
parent | d98d9025b8a0fd842ce5ee4d157f4e58577f4458 (diff) | |
download | qt-creator-f1a05dfb35eaf8a24b67d8b018b957aba12a8c4e.tar.gz |
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>
-rw-r--r-- | src/plugins/debugger/lldb/lldbengine.cpp | 8 | ||||
-rw-r--r-- | src/plugins/debugger/lldb/lldbengine.h | 6 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index a669515c3b..1a8593686b 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -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); } diff --git a/src/plugins/debugger/lldb/lldbengine.h b/src/plugins/debugger/lldb/lldbengine.h index c3aca9df41..3cc52f5ea3 100644 --- a/src/plugins/debugger/lldb/lldbengine.h +++ b/src/plugins/debugger/lldb/lldbengine.h @@ -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); |