forked from keepassxreboot/keepassxc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent Klipper from storing secrets in clipboard history (keepassxre…
- Loading branch information
1 parent
ca27fb0
commit 08a36b4
Showing
2 changed files
with
11 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/* | ||
* Copyright (C) 2017 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2012 Felix Geyer <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -19,6 +20,7 @@ | |
|
||
#include <QApplication> | ||
#include <QClipboard> | ||
#include <QMimeData> | ||
#include <QTimer> | ||
|
||
#include "core/Config.h" | ||
|
@@ -46,15 +48,20 @@ void Clipboard::setText(const QString& text) | |
{ | ||
QClipboard* clipboard = QApplication::clipboard(); | ||
|
||
#ifdef Q_OS_MAC | ||
QMimeData* mime = new QMimeData; | ||
#ifdef Q_OS_MAC | ||
mime->setText(text); | ||
mime->setData("application/x-nspasteboard-concealed-type", text.toUtf8()); | ||
clipboard->setMimeData(mime, QClipboard::Clipboard); | ||
#else | ||
clipboard->setText(text, QClipboard::Clipboard); | ||
const QString secretStr = "secret"; | ||
QByteArray secretBa = secretStr.toUtf8(); | ||
mime->setText(text); | ||
mime->setData("x-kde-passwordManagerHint", secretBa); | ||
clipboard->setMimeData(mime, QClipboard::Clipboard); | ||
|
||
if (clipboard->supportsSelection()) { | ||
clipboard->setText(text, QClipboard::Selection); | ||
clipboard->setMimeData(mime, QClipboard::Selection); | ||
} | ||
#endif | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/* | ||
* Copyright (C) 2017 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2012 Felix Geyer <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
|