Fix problem with user-encryption when the a shared file is moved#38375
Merged
jvillafanez merged 2 commits intomasterfrom Feb 19, 2021
Merged
Fix problem with user-encryption when the a shared file is moved#38375jvillafanez merged 2 commits intomasterfrom
jvillafanez merged 2 commits intomasterfrom
Conversation
Checked scenario below but moving a file instead of a folder:
admin creates "folderA"
admins shares "folderA" with user1 and user2
user1 creates "folderB" (in his home) and uploads content inside "folderB"
user1 moves "folderB" inside the shared folder "folderA" (leads to "folderA/folderB" being shared)
user2 moves "folderA/folderB" (step3) in his own home directory
admin has a "folderB" in his trashbin
admin restores the "folderB" from the trashbin -> "folderA/folderB" reappears
contents from "folderA/folderB" (the ones restored that are now shared again) aren't accessible (Bad Encryption exception)
The file / folder in the admin's trashbin had a wrong signature caused
by a wrong update of the encryptedVersion in the DB. This change bypass
that update in that particular scenario. The rest of the scenarios
weren't affected and will work the same way as before
Member
Author
|
Checked both with master-key encryption and user-key encryption. The problematic scenario works |
JammingBen
approved these changes
Feb 9, 2021
phil-davis
reviewed
Feb 16, 2021
Contributor
phil-davis
left a comment
There was a problem hiding this comment.
I guess this should have a changelog?
And no tests were changed/added. Is there some way to have a unit test that simulates this problem somehow?
Member
Author
|
There are operations using native resources through the code path to be tested ( core/lib/private/Files/Storage/Wrapper/Encryption.php Lines 792 to 793 in fc8659a Changelog coming soon. |
|
Kudos, SonarCloud Quality Gate passed! |
phil-davis
approved these changes
Feb 19, 2021
Contributor
|
@jvillafanez anything else to do? Merge? |
Contributor
|
Note: owncloud/encryption#244 - some trashbin+local-storage+encryption tests failed last night. |
karakayasemi
added a commit
that referenced
this pull request
Mar 7, 2021
11 tasks
karakayasemi
added a commit
that referenced
this pull request
Mar 7, 2021
phil-davis
added a commit
that referenced
this pull request
Mar 7, 2021
Fix regression that occurred after #38375
phil-davis
pushed a commit
that referenced
this pull request
Mar 7, 2021
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checked scenario below but moving a file instead of a folder:
admin creates "folderA"
admins shares "folderA" with user1 and user2
user1 creates "folderB" (in his home) and uploads content inside "folderB"
user1 moves "folderB" inside the shared folder "folderA" (leads to "folderA/folderB" being shared)
user2 moves "folderA/folderB" (step3) in his own home directory
admin has a "folderB" in his trashbin
admin restores the "folderB" from the trashbin -> "folderA/folderB" reappears
contents from "folderA/folderB" (the ones restored that are now shared again) aren't accessible (Bad Encryption exception)
The file / folder in the admin's trashbin had a wrong signature caused
by a wrong update of the encryptedVersion in the DB. This change bypass
that update in that particular scenario. The rest of the scenarios
weren't affected and will work the same way as before
Description
Fix broken signature of a backup copy created from the shared folder when the file is moved to the home directory of another user.
Minor additional changes included:
$sourceStorage->getCache()->get(...)returned false.Related Issue
https://github.com/owncloud/enterprise/issues/4372
steps to reproduce are above and in https://github.com/owncloud/enterprise/issues/4372#issuecomment-769843523
Motivation and Context
The code creates a broken copy of a file inside the trashbin. Restoring the file from the trashbin will still keep the broken signature. This change fixes this behaviour, so the file can be restored if needed.
How Has This Been Tested?
Tested following the reproduction steps.
Screenshots (if appropriate):
Types of changes
Checklist: