From ee92b980bb11e62de42664cfe87547a316f04e37 Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Wed, 12 May 2021 20:20:41 -0700 Subject: [PATCH] Set permissions of saved attachments to be private to the current user (#6363) --- src/gui/entry/EntryAttachmentsWidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/entry/EntryAttachmentsWidget.cpp b/src/gui/entry/EntryAttachmentsWidget.cpp index 7bea0fdb5..93557c042 100644 --- a/src/gui/entry/EntryAttachmentsWidget.cpp +++ b/src/gui/entry/EntryAttachmentsWidget.cpp @@ -245,7 +245,8 @@ void EntryAttachmentsWidget::saveSelectedAttachments() QFile file(attachmentPath); const QByteArray attachmentData = m_entryAttachments->value(filename); - const bool saveOk = file.open(QIODevice::WriteOnly) && file.write(attachmentData) == attachmentData.size(); + const bool saveOk = file.open(QIODevice::WriteOnly) && file.setPermissions(QFile::ReadUser | QFile::WriteUser) + && file.write(attachmentData) == attachmentData.size(); if (!saveOk) { errors.append(QString("%1 - %2").arg(filename, file.errorString())); }