Skip to content
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

[encryption] reorganize folder structure (second try to make Jenkins happy) #12382

Merged
merged 6 commits into from Dec 3, 2014

Conversation

schiessle
Copy link
Contributor

In order to fix #11297 I changed the folder structure for the encryption keys.

We create for every file a corresponding folder in files_encryption/keys. For example for "foo/test.txt" we will create a folder "files_encryption/keys/foo/test.txt/". This folder will contain all share keys, named "userId.shareKey" and the file key named "fileKey". This way we avoid any name collision with file names which are similar to user names, like described in issue #11297.

This makes many file operation easier. If a file gets renamed or moved we just have to rename/move the corresponding folder. This way we can save a lot of overhead to find the correct share-keys and file-keys which should result in some performance improvements and should also make the code more robust.

Additionally this PR changes the naming for public/private keys from "user.public.key" and user.private.key" to "user.publicKey" and user.privateKey" for consistency reasons.

This PR touches all aspects of encryption, so we need to test encryption as complete as possible, including:

  • sharing, reshares,...
  • deleting single files or complete folders
  • restore the deleted file/folder from the trashbin or just single files/sub-folders from the deleted folder
  • enabling recovery keys
  • change passwords
  • recover files
  • deleted shared files and try to restore them
  • ...

Currently the migration script is missing. But everything should work if you start with a fresh installation or a setup without any encrypted files and encryption keys.

Currently missing:

  • migration script

@schiessle schiessle changed the title Enc reorganize folders2 [encryption] reorganize folder structure (second try to make Jenkins happy) Nov 24, 2014
@schiessle schiessle added this to the 8.0-current milestone Nov 24, 2014
Bjoern Schiessle added 3 commits November 26, 2014 10:57
all keys are now in files_encryption/key/path_to_file/filename/
share keys are named: user.shareKey
file key is named: fileKey
@ghost
Copy link

ghost commented Nov 26, 2014

🚀 Test PASSed. 🚀
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/3293/
🚀 Test PASSed. 🚀


// If data is a catfile
if (
Crypt::mode() === 'server'
&& $this->shouldEncrypt($path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional bugfix or needed as per this PR's changes ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, obsoletes the need to disable the file proxy

@PVince81
Copy link
Contributor

Wow, glad to see this removes a lot of code.

This will need a full regression test:

  • all file operations
  • sharing + all file operations (including move in/out of a shared dir)
  • recovery keys
  • add/delete user (keys deletion)

@PVince81
Copy link
Contributor

  • test with ext storage: system mounts and personal mounts

@PVince81
Copy link
Contributor

  • test migration with non-initialized users

@PVince81
Copy link
Contributor

Code looks good. Needs testing.

@PVince81
Copy link
Contributor

  • trashbin (delete, restore files and folders)
  • versions (download, restore version)

@PVince81
Copy link
Contributor

@PVince81
Copy link
Contributor

@PVince81
Copy link
Contributor

@PVince81
Copy link
Contributor

I'm done testing. Please see the above bugs.

@schiessle
Copy link
Contributor Author

BUG: user1 shares folder with user2. Recover user2's password. user2 cannot read shared files in folder.

Unrelated, this also happens on oc7/master. Currently we only recover the files from the user. Recover shared files can only work if the owner has also enabled the recovery key

share folder with user1, delete user1: share keys for user1 not removed

most likely this also happens on oc7/master, do you remember the issue that not all share keys get cleaned-up in all circumstances?

@schiessle
Copy link
Contributor Author

BUG: cannot download previous versions from the versions dropdown

known issue, unrelated to this bug: #12221

@schiessle
Copy link
Contributor Author

BUG: WebDAV MOVE from root to shared folder as non-owner gives 403 (web UI move works)

This also happens on master without encryption. Probably a sharing permission issue. Please open a seperate issue for it.

@ghost
Copy link

ghost commented Nov 28, 2014

🚀 Test PASSed. 🚀
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/3486/
🚀 Test PASSed. 🚀

@PVince81
Copy link
Contributor

PVince81 commented Dec 2, 2014

  • BUG: migration doesn't seem to delete "files_trashbin/{share-keys,keyfiles}" (minor)

@PVince81
Copy link
Contributor

PVince81 commented Dec 2, 2014

Apart from the minor issue, I'm ok to have this merged 👍

@schiessle
Copy link
Contributor Author

Added migration of trash bin, including unit tests.

This needs a second reviewer... Maybe @LukasReschke @MorrisJobke @nickvergessen, or anyone else ? Thanks!

@scrutinizer-notifier
Copy link

The inspection completed: 49 new issues, 67 updated code elements

@schiessle
Copy link
Contributor Author

@owncloud-bot retest this please

@ghost
Copy link

ghost commented Dec 2, 2014

💣 Test FAILed. 💣
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/3641/

Build result: FAILURE

[...truncated 14 lines...] > git config remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10 > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10Fetching upstream changes from https://github.com/owncloud/core.gitusing GIT_SSH to set credentials using .gitcredentials to set credentials > git config --local credential.helper store --file=/tmp/git18099305855542784.credentials # timeout=10 > git fetch --tags --progress https://github.com/owncloud/core.git +refs/pull/:refs/remotes/origin/pr/ > git config --local --remove-section credential # timeout=10 > git rev-parse origin/pr/12382/merge^{commit} # timeout=10Checking out Revision 0a63738400011b98682db94503f7373626603a6b (detached) > git config core.sparsecheckout # timeout=10 > git checkout -f 0a63738400011b98682db94503f7373626603a6b > git rev-list e24a11e378c1d0992f1089e32aa3ea3fcb4d6311 # timeout=10 > git remote # timeout=10 > git submodule init # timeout=10 > git submodule sync # timeout=10 > git config --get remote.origin.url # timeout=10 > git submodule update --init --recursiveTriggering pull-request-analyser-ng-simple » vm-slave-02pull-request-analyser-ng-simple » vm-slave-02 completed with result FAILUREStarted calculate disk usage of buildFinished Calculation of disk usage of build in 0 secondsStarted calculate disk usage of workspaceFinished Calculation of disk usage of workspace in 1 second
💣 Test FAILed. 💣

@MorrisJobke
Copy link
Contributor

I guess the "new PR to satisfy jenkins" approach has to be applied here :(

hudson.plugins.git.GitException: Could not checkout null with start point f6fed320c03c0e81b88a44637352dd4b26565af3

@schiessle
Copy link
Contributor Author

Here is a new PR for Jenkins: #12575

@MorrisJobke
Copy link
Contributor

I will review this now.

@MorrisJobke
Copy link
Contributor

I tested this:

  • installed master, uploaded some files, shared a folder to admin (without any new users), added to users (one to admin group), added the other user to a share, shared a file/folder by link
  • checked if all works
  • updated to this branch
  • tested all shares, deleted files from shares and restored from owner account, renamed, downloaded
  • changed password
  • updated a file. Is downloadable by other sharees

👍 from me

@MorrisJobke
Copy link
Contributor

Jenkins is fine with this (see other PR)

MorrisJobke added a commit that referenced this pull request Dec 3, 2014
[encryption] reorganize folder structure (second try to make Jenkins happy)
@MorrisJobke MorrisJobke merged commit 3fdb193 into master Dec 3, 2014
@MorrisJobke MorrisJobke deleted the enc_reorganize_folders2 branch December 3, 2014 15:08
@@ -17,7 +19,7 @@
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
* License alon with this library. If not, see <http://www.gnu.org/licenses/>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alon?

@lock lock bot locked as resolved and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Encryption key names conflicts in very specific cases with user name inside file name
5 participants