mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-24 05:55:59 +03:00
Show a broken lock icon for unencrypted subdirectory
The E2E application allows creating unencrypted subdirectories in an encrypted parent. This is a big privacy problem. This patch shows a red broken lock icon for these subdirectories in the NC client UI. Signed-off-by: Ivan Čukić <ivan.cukic@kde.org>
This commit is contained in:
parent
f286603ffe
commit
c800d9149e
5 changed files with 21 additions and 0 deletions
|
@ -158,6 +158,8 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
|
|||
case Qt::DecorationRole:
|
||||
if (_accountState->account()->e2e()->isFolderEncrypted(x._path)) {
|
||||
return QIcon(QLatin1String(":/client/theme/lock-https.svg"));
|
||||
} else if (_accountState->account()->e2e()->isAnyParentFolderEncrypted(x._path)) {
|
||||
return QIcon(QLatin1String(":/client/theme/lock-broken.svg"));
|
||||
}
|
||||
return QFileIconProvider().icon(x._isExternal ? QFileIconProvider::Network : QFileIconProvider::Folder);
|
||||
case Qt::ForegroundRole:
|
||||
|
|
|
@ -1482,6 +1482,22 @@ bool ClientSideEncryption::isFolderEncrypted(const QString& path) const {
|
|||
return (*it);
|
||||
}
|
||||
|
||||
bool ClientSideEncryption::isAnyParentFolderEncrypted(const QString &path) const
|
||||
{
|
||||
int slashPosition = 0;
|
||||
|
||||
while ((slashPosition = path.indexOf("/", slashPosition + 1)) != -1) {
|
||||
// Ignore the last slash
|
||||
if (slashPosition == path.length() - 1) break;
|
||||
|
||||
if (isFolderEncrypted(path.left(slashPosition + 1))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EncryptionHelper::fileEncryption(const QByteArray &key, const QByteArray &iv, QFile *input, QFile *output, QByteArray& returnTag)
|
||||
{
|
||||
if (!input->open(QIODevice::ReadOnly)) {
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
|
||||
// to be used together with FolderStatusModel::FolderInfo::_path.
|
||||
bool isFolderEncrypted(const QString& path) const;
|
||||
bool isAnyParentFolderEncrypted(const QString &path) const;
|
||||
void setFolderEncryptedStatus(const QString& path, bool status);
|
||||
|
||||
void forgetSensitiveData();
|
||||
|
|
|
@ -153,6 +153,7 @@
|
|||
<file>theme/change.svg</file>
|
||||
<file>theme/lock-http.svg</file>
|
||||
<file>theme/lock-https.svg</file>
|
||||
<file>theme/lock-broken.svg</file>
|
||||
<file>theme/network.svg</file>
|
||||
<file>theme/account.svg</file>
|
||||
<file>theme/colored/add.svg</file>
|
||||
|
|
1
theme/lock-broken.svg
Normal file
1
theme/lock-broken.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg width="64" height="64" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><path d="m32 4c-9.276 0-15.868 7.4576-16 16v10h-6v18.914l-6 6 5.6562 5.6562 50.914-50.914-5.6562-5.6562-8.7266 8.7266c-2.6278-5.2025-7.9771-8.6518-14.188-8.7266zm0 8c4.5949 0 7.4656 3.2614 7.9062 7.0078l-10.992 10.992h-4.9141v-10c0-4.696 2.988-8 8-8zm16.227 18-30 30h35.773v-30z" fill="#c13030"/></svg>
|
After Width: | Height: | Size: 400 B |
Loading…
Reference in a new issue