diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-11-12 13:18:02 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-11-26 12:55:11 +0000 |
commit | a2e7b8412f56841e12ed20a39f4a38e32d3c1e30 (patch) | |
tree | 586dabdaf301070f3428cb7582dce13cff81cfb7 | |
parent | c0ac7a4c684e2fed60a72ceee53da89eea3f95a7 (diff) |
Restrict more sensitive debugging output
There are more places where sensitive information could accidentally be
disclosed.
Also, move SENSITIVE_DEBUG to config.pri so that plugins can use it.
Change-Id: Ifa4ccbd6bf4bf79412f29984c662c9e58ea01992
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Yuntaek Rim <yuntaek.rim@myscript.com>
(cherry picked from commit 5d2d0564a36f99224dc53ad477416097516c6b77)
-rw-r--r-- | src/config.pri | 4 | ||||
-rw-r--r-- | src/virtualkeyboard/3rdparty/openwnn/wnnEngine/composingtext.cpp | 2 | ||||
-rw-r--r-- | src/virtualkeyboard/inputcontext.cpp | 18 | ||||
-rw-r--r-- | src/virtualkeyboard/lipiinputmethod.cpp | 6 | ||||
-rw-r--r-- | src/virtualkeyboard/t9writeinputmethod.cpp | 2 | ||||
-rw-r--r-- | src/virtualkeyboard/t9writeworker.cpp | 4 | ||||
-rw-r--r-- | src/virtualkeyboard/virtualkeyboarddebug.h | 4 |
7 files changed, 29 insertions, 11 deletions
diff --git a/src/config.pri b/src/config.pri index 11ae1c0b..bfa04d05 100644 --- a/src/config.pri +++ b/src/config.pri @@ -66,3 +66,7 @@ disable-xcb { message("The disable-xcb option has been deprecated. Please use disable-desktop instead.") CONFIG += disable-desktop } + +# Enables logging of sensitive information, such as key events. +# Should never be enabled by default. +sensitive-debug: DEFINES += SENSITIVE_DEBUG diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/composingtext.cpp b/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/composingtext.cpp index e299c6db..082d2fc8 100644 --- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/composingtext.cpp +++ b/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/composingtext.cpp @@ -206,6 +206,7 @@ StrSegment ComposingText::getStrSegment(TextLayer layer, int pos) const void ComposingText::debugout() const { +#ifdef SENSITIVE_DEBUG Q_D(const ComposingText); for (int i = LAYER0; i < MAX_LAYER; i++) { qDebug() << QString("ComposingText[%1]").arg(i); @@ -217,6 +218,7 @@ void ComposingText::debugout() const } qDebug() << " str =" << tmp; } +#endif } QString ComposingText::toString(TextLayer layer, int from, int to) const diff --git a/src/virtualkeyboard/inputcontext.cpp b/src/virtualkeyboard/inputcontext.cpp index ccc29bb8..ff4cb3ce 100644 --- a/src/virtualkeyboard/inputcontext.cpp +++ b/src/virtualkeyboard/inputcontext.cpp @@ -505,7 +505,11 @@ void InputContext::commit() void InputContext::commit(const QString &text, int replaceFrom, int replaceLength) { Q_D(InputContext); - VIRTUALKEYBOARD_DEBUG() << "InputContext::commit():" << text << replaceFrom << replaceLength; + VIRTUALKEYBOARD_DEBUG() << "InputContext::commit()" +#ifdef SENSITIVE_DEBUG + << text << replaceFrom << replaceLength +#endif + ; bool preeditChanged = !d->preeditText.isEmpty(); d->preeditText.clear(); d->preeditTextAttributes.clear(); @@ -674,7 +678,11 @@ void InputContext::setFocus(bool enable) void InputContext::sendPreedit(const QString &text, const QList<QInputMethodEvent::Attribute> &attributes, int replaceFrom, int replaceLength) { Q_D(InputContext); - VIRTUALKEYBOARD_DEBUG() << "InputContext::sendPreedit():" << text << replaceFrom << replaceLength; + VIRTUALKEYBOARD_DEBUG() << "InputContext::sendPreedit()" +#ifdef SENSITIVE_DEBUG + << text << replaceFrom << replaceLength +#endif + ; bool textChanged = d->preeditText != text; bool attributesChanged = d->preeditTextAttributes != attributes; @@ -697,7 +705,11 @@ void InputContext::sendPreedit(const QString &text, const QList<QInputMethodEven // input may be out of sync. if (d->shadow.inputItem() && !replace && !text.isEmpty() && !textChanged && attributesChanged) { - VIRTUALKEYBOARD_DEBUG() << "InputContext::sendPreedit(shadow):" << text << replaceFrom << replaceLength; + VIRTUALKEYBOARD_DEBUG() << "InputContext::sendPreedit(shadow)" +#ifdef SENSITIVE_DEBUG + << text << replaceFrom << replaceLength +#endif + ; event.setAccepted(true); QGuiApplication::sendEvent(d->shadow.inputItem(), &event); } diff --git a/src/virtualkeyboard/lipiinputmethod.cpp b/src/virtualkeyboard/lipiinputmethod.cpp index 30ee9ed4..ffb9688d 100644 --- a/src/virtualkeyboard/lipiinputmethod.cpp +++ b/src/virtualkeyboard/lipiinputmethod.cpp @@ -781,9 +781,9 @@ void LipiInputMethod::timerEvent(QTimerEvent *timerEvent) void LipiInputMethod::resultsAvailable(const QVariantList &resultList) { -#ifdef QT_VIRTUALKEYBOARD_DEBUG - { - VIRTUALKEYBOARD_DEBUG() << "LipiInputMethod::resultsAvailable():"; +#ifdef SENSITIVE_DEBUG + if (lcLipi().isDebugEnabled()) { + qCDebug(lcLipi) << "LipiInputMethod::resultsAvailable():"; for (int i = 0; i < resultList.size(); i++) { QVariantMap result = resultList.at(i).toMap(); VIRTUALKEYBOARD_DEBUG() << QString("%1: %2 (%3)").arg(i + 1).arg(result["unicode"].toChar()).arg(result["confidence"].toFloat()).toUtf8().constData(); diff --git a/src/virtualkeyboard/t9writeinputmethod.cpp b/src/virtualkeyboard/t9writeinputmethod.cpp index eb4cf9fb..7f835249 100644 --- a/src/virtualkeyboard/t9writeinputmethod.cpp +++ b/src/virtualkeyboard/t9writeinputmethod.cpp @@ -1292,7 +1292,7 @@ void T9WriteInputMethod::dictionaryLoadCompleted(const QString &fileUri, void *d void T9WriteInputMethod::resultsAvailable(const QVariantList &resultList) { -#ifdef QT_VIRTUALKEYBOARD_DEBUG +#ifdef SENSITIVE_DEBUG { VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethod::resultsAvailable():"; for (int i = 0; i < resultList.size(); i++) { diff --git a/src/virtualkeyboard/t9writeworker.cpp b/src/virtualkeyboard/t9writeworker.cpp index 2de62a0b..f4478da3 100644 --- a/src/virtualkeyboard/t9writeworker.cpp +++ b/src/virtualkeyboard/t9writeworker.cpp @@ -146,7 +146,9 @@ T9WriteRecognitionTask::T9WriteRecognitionTask(QSharedPointer<T9WriteRecognition stringStart(stringStart), stateCancelled(false) { - VIRTUALKEYBOARD_DEBUG() << "T9WriteRecognitionTask():" << "boostLevel:" << boostLevel << "stringStart:" << stringStart; +#ifdef SENSITIVE_DEBUG + qCDebug(lcT9Write) << "T9WriteRecognitionTask():" << "boostLevel:" << boostLevel << "stringStart:" << stringStart; +#endif } void T9WriteRecognitionTask::run() diff --git a/src/virtualkeyboard/virtualkeyboarddebug.h b/src/virtualkeyboard/virtualkeyboarddebug.h index 6dee6372..02dbd80b 100644 --- a/src/virtualkeyboard/virtualkeyboarddebug.h +++ b/src/virtualkeyboard/virtualkeyboarddebug.h @@ -35,9 +35,7 @@ Q_DECLARE_LOGGING_CATEGORY(qlcVirtualKeyboard) -// Enables logging of sensitive information, such as key events. -// Should never be enabled by default. -//#define SENSITIVE_DEBUG +// See config.pri for SENSITIVE_DEBUG. #define VIRTUALKEYBOARD_DEBUG() qCDebug(qlcVirtualKeyboard) #define VIRTUALKEYBOARD_WARN() qCWarning(qlcVirtualKeyboard) |