From 993a21ba03534b172d5354405cc9d50a2a822e24 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 12 Nov 2018 13:18:02 +0100 Subject: 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 Reviewed-by: Jarkko Koivikko Reviewed-by: Yuntaek Rim (cherry picked from commit 5d2d0564a36f99224dc53ad477416097516c6b77) --- src/config.pri | 6 ++++++ .../3rdparty/openwnn/wnnEngine/composingtext.cpp | 2 ++ src/virtualkeyboard/inputcontext.cpp | 12 ++++++++++-- src/virtualkeyboard/lipiinputmethod.cpp | 2 +- src/virtualkeyboard/t9writeinputmethod.cpp | 2 +- src/virtualkeyboard/t9writeworker.cpp | 2 ++ src/virtualkeyboard/virtualkeyboarddebug.h | 4 +--- 7 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/config.pri b/src/config.pri index 6c4bc0d0..024515b6 100644 --- a/src/config.pri +++ b/src/config.pri @@ -54,3 +54,9 @@ 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. +# It's defined here rather than virtualkeyboarddebug_p.h +# so that the plugins can use it. +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 394631b5..1808b0a2 100644 --- a/src/virtualkeyboard/inputcontext.cpp +++ b/src/virtualkeyboard/inputcontext.cpp @@ -475,7 +475,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(); @@ -580,7 +584,11 @@ void InputContext::setFocus(bool enable) void InputContext::sendPreedit(const QString &text, const QList &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; diff --git a/src/virtualkeyboard/lipiinputmethod.cpp b/src/virtualkeyboard/lipiinputmethod.cpp index 4f832573..0d0c48b5 100644 --- a/src/virtualkeyboard/lipiinputmethod.cpp +++ b/src/virtualkeyboard/lipiinputmethod.cpp @@ -773,7 +773,7 @@ void LipiInputMethod::timerEvent(QTimerEvent *timerEvent) void LipiInputMethod::resultsAvailable(const QVariantList &resultList) { -#ifdef QT_VIRTUALKEYBOARD_DEBUG +#ifdef SENSITIVE_DEBUG { VIRTUALKEYBOARD_DEBUG() << "LipiInputMethod::resultsAvailable():"; for (int i = 0; i < resultList.size(); i++) { diff --git a/src/virtualkeyboard/t9writeinputmethod.cpp b/src/virtualkeyboard/t9writeinputmethod.cpp index a2f45c18..3abac7ae 100644 --- a/src/virtualkeyboard/t9writeinputmethod.cpp +++ b/src/virtualkeyboard/t9writeinputmethod.cpp @@ -1280,7 +1280,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 53422a6c..955eb9f7 100644 --- a/src/virtualkeyboard/t9writeworker.cpp +++ b/src/virtualkeyboard/t9writeworker.cpp @@ -138,7 +138,9 @@ T9WriteRecognitionTask::T9WriteRecognitionTask(QSharedPointer -// 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 QT_VIRTUALKEYBOARD_DEBUG #ifdef QT_VIRTUALKEYBOARD_DEBUG -- cgit v1.2.3