-
Notifications
You must be signed in to change notification settings - Fork 964
fix(UI): validate E2EE file names #10238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
68c082f
91d3ec0
047b9ec
09e3864
b05f17b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors | ||
| * SPDX-License-Identifier: GPL-2.0-or-later | ||
| */ | ||
|
Check warning on line 4 in src/libsync/propagateuploadencrypted.cpp
|
||
| #include "propagateuploadencrypted.h" | ||
| #include "clientsideencryptionjobs.h" | ||
| #include "networkjobs.h" | ||
|
|
@@ -79,12 +79,12 @@ | |
| return _encryptedFolderMetadataHandler->isFolderLocked(); | ||
| } | ||
|
|
||
| const QByteArray PropagateUploadEncrypted::folderToken() const | ||
|
Check warning on line 82 in src/libsync/propagateuploadencrypted.cpp
|
||
| { | ||
| return _encryptedFolderMetadataHandler ? _encryptedFolderMetadataHandler->folderToken() : QByteArray{}; | ||
| } | ||
|
|
||
| void PropagateUploadEncrypted::slotFetchMetadataJobFinished(int statusCode, const QString &message) | ||
|
Check warning on line 87 in src/libsync/propagateuploadencrypted.cpp
|
||
| { | ||
| qCDebug(lcPropagateUploadEncrypted) << "Metadata Received, Preparing it for the new file." << message; | ||
|
|
||
|
|
@@ -149,7 +149,7 @@ | |
| QFile output(QDir::tempPath() + QDir::separator() + encryptedFile.encryptedFilename); | ||
|
|
||
| QByteArray tag; | ||
| bool encryptionResult = EncryptionHelper::fileEncryption(encryptedFile.encryptionKey, encryptedFile.initializationVector, &input, &output, tag); | ||
|
Check warning on line 152 in src/libsync/propagateuploadencrypted.cpp
|
||
|
|
||
| if (!encryptionResult) { | ||
| qCWarning(lcPropagateUploadEncrypted()) << "There was an error encrypting the file, aborting upload."; | ||
|
|
@@ -163,7 +163,11 @@ | |
|
|
||
| qCDebug(lcPropagateUploadEncrypted) << "Creating the metadata for the encrypted file."; | ||
|
|
||
| metadata->addEncryptedFile(encryptedFile); | ||
| if (!metadata->addEncryptedFile(encryptedFile)) { | ||
| qCWarning(lcPropagateUploadEncrypted()) << "There was an error encrypting the file, aborting upload. Invalid metadata file name."; | ||
| emit error(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When this new rejection is reached for an encrypted directory upload, such as a POSIX folder named Useful? React with 👍 / 👎. |
||
| return; | ||
| } | ||
|
|
||
| qCDebug(lcPropagateUploadEncrypted) << "Metadata created, sending to the server."; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When an existing encrypted folder's metadata contains an invalid original name, this branch returns an empty
EncryptedFile;setupExistingMetadata()then just skips appending it and still marks the metadata valid. In that scenario the corresponding server entry remains in the PROPFIND results without ane2eMangledName/encrypted flag, so discovery can treat the encrypted blob itself as a normal plaintext child under its mangled server name instead of failing the sync. Please make parsing fail the metadata setup, or otherwise filter that remote entry, rather than silently dropping the mapping.Useful? React with 👍 / 👎.