From 6f9721765017dbd4c6dba2131c544bf3552d1592 Mon Sep 17 00:00:00 2001 From: Robert Hoffmann Date: Wed, 16 May 2018 10:23:46 +0100 Subject: [PATCH 1/3] Klipper: Do not insert secret data into history Summary: Password manager tools like Keepassx offer an option to clear the clipboard/selection after some time, e.g. 10 seconds, after the password was copied to the clipboard. This works fine, but unfortunately the password isn't removed from Klipper's history. This is a great security risk, which may make the use of password managers impossible. This patch changes Klipper::applyClipChanges(const QMimeData* clipData) where clipboard data is inserted into history. If the data has an additional mime type 'x-kde-passwordManagerHint' with the data 'secret', it is not inserted into history. For this to work as designed, password managers should add the additional mime type 'x-kde-passwordManagerHint' to the mimeData like following when copying a password to the clipboard: ``` QMimeData* mimeDataClipboard = new QMimeData(); const QString secretStr = "secret"; QByteArray secretBa = secretStr.toUtf8(); mimeDataClipboard->setText(password); // this is the password to copy mimeDataClipboard->setData("x-kde-passwordManagerHint", secretBa); clipboard->setMimeData(mimeDataClipboard, QClipboard::Clipboard); if (clipboard->supportsSelection()) { // we cannot use the same QMimeData, it's already owned by clipboard QMimeData* mimeDataSelection = new QMimeData(); mimeDataSelection->setText(password); // this is the password to copy mimeDataSelection->setData("x-kde-passwordManagerHint", secretBa); clipboard->setMimeData(mimeDataSelection, QClipboard::Selection); } ``` Reviewers: davidedmundson Reviewed By: davidedmundson Subscribers: dvratil, broulik, graesslin, davidedmundson, plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D12539 --- klipper/klipper.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/klipper/klipper.cpp b/klipper/klipper.cpp index af31a2ea4..cc8f6f591 100644 --- a/klipper/klipper.cpp +++ b/klipper/klipper.cpp @@ -604,7 +604,9 @@ HistoryItemPtr Klipper::applyClipChanges( const QMimeData* clipData ) } Ignore lock( m_locklevel ); HistoryItemPtr item = HistoryItem::create( clipData ); - history()->insert( item ); + if (clipData->data("x-kde-passwordManagerHint") != QByteArrayLiteral("secret")) { + history()->insert( item ); + } return item; } From ab8207bde4ac02810a4433e4bdb3b6f52cdda3bf Mon Sep 17 00:00:00 2001 From: Jonathan Riddell Date: Tue, 25 Sep 2018 10:30:16 +0100 Subject: [PATCH 2/3] Update version number for 5.12.7 GIT_SILENT --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 810eec8f0..4695a3df9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ project(plasma-workspace) -set(PROJECT_VERSION "5.12.6") +set(PROJECT_VERSION "5.12.7") set(PROJECT_VERSION_MAJOR 5) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) From c2ea0afb559687690cd72ab7c39fd42e5bc8ed32 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 1 Oct 2018 14:40:51 +0100 Subject: [PATCH 3/3] Fallback to in-process prompt if logout prompt fails Summary: KSmserver is currently very heavily tied to the shutdown prompt dialog. On upgrades a user ends up in a situation where they have an old ksmserver running but a newer shutdown dialog. This has caused issues repeatedly in the past. I want to make some changes to how the shutdown prompt is shown for 5.15. First step is making the old releases more robust. Prompt looks ugly but a user will only see it at most once. Hopefully never. Test Plan: rm'd the greeter Got an ugly messagebox instead of nothing Reviewers: #plasma, broulik, ngraham Reviewed By: #plasma, broulik Subscribers: ngraham, broulik, plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D15869 --- ksmserver/shutdown.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp index 9f290285e..f7f665c3a 100644 --- a/ksmserver/shutdown.cpp +++ b/ksmserver/shutdown.cpp @@ -215,9 +215,36 @@ void KSMServer::shutdown( KWorkSpace::ShutdownConfirm confirm, const int resultPipe = pipeFds[0]; connect(p, static_cast(&QProcess::error), this, - [this, resultPipe] { + [this, resultPipe, sdmode, sdtype] { close(resultPipe); dialogActive = false; + auto fallbackPrompt = new QMessageBox; + fallbackPrompt->setAttribute(Qt::WA_DeleteOnClose, true); + fallbackPrompt->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + switch (sdtype) { + case KWorkSpace::ShutdownTypeHalt: + //i18nd is used as this patch was backported to an LTS with stable translations + fallbackPrompt->setText(i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shutdown")); + break; + case KWorkSpace::ShutdownTypeReboot: + fallbackPrompt->setText(i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Reboot")); + break; + case KWorkSpace::ShutdownTypeNone: + Q_FALLTHROUGH(); + default: + fallbackPrompt->setText(i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Logout")); + break; + } + connect(fallbackPrompt, &QMessageBox::buttonClicked, this, [=](QAbstractButton *button) { + if (button != fallbackPrompt->button(QMessageBox::Ok)) { + return; + } + shutdownType = sdtype; + shutdownMode = sdmode; + bootOption = QString(); + performLogout(); + }); + fallbackPrompt->show(); } );