From f1a05dfb35eaf8a24b67d8b018b957aba12a8c4e Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 6 Dec 2016 16:06:08 +0100 Subject: [PATCH] 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 Reviewed-by: Eike Ziller --- src/plugins/debugger/lldb/lldbengine.cpp | 8 +++++++- src/plugins/debugger/lldb/lldbengine.h | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index a669515c3bb..1a8593686bd 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -61,6 +61,7 @@ #include #include #include +#include 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\":.[^]]*."), ""); + 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 c3aca9df412..3cc52f5ea34 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);