Skip to content

Encryption copy keys first3 - #40483

Merged
jnweiger merged 7 commits into
masterfrom
encryption_copy_keys_first3
Dec 21, 2022
Merged

Encryption copy keys first3#40483
jnweiger merged 7 commits into
masterfrom
encryption_copy_keys_first3

Conversation

@jvillafanez

Copy link
Copy Markdown
Member

Description

Follow up on #40433 to solve https://github.com/owncloud/enterprise/issues/5344

The PR will copy the encryption keys instead of renaming them, so in case of error we can revert the action and we keep the encryption keys in the right location so the target file can be decrypted.

It seems the old PR was causing problems due to the failures caused by empty directories, which don't have encryption keys associated. The copyKeys method was reporting a failure because the expected directory with the keys doesn't exist. This has been adjusted: both copyKeys and renameKeys methods will return true if the directory doesn't exists.

Related Issue

https://github.com/owncloud/enterprise/issues/5344

Motivation and Context

Tests from other apps were failing due to the changes made in the old PR (which was reverted). This PR should cover the old failing scenarios.

How Has This Been Tested?

Checked some of the previously failing scenarios.

  1. With encryption active (after re-login to create the keys), create an empty directory
  2. Delete the directory

With the old PR, a log about the encryption keys not being copied was showing. There was a forbidden exception happening. This is not happening with this PR.

  1. With encryption active, create a directory and upload a file there
  2. Run occ encryption:recreate-master-key command
  3. From the desktop client, logout, login and upload a file

With the old PR, there were errors happening and uploading wasn't possible. This is also fixed with this PR.

  1. With encryption active, create a directory
  2. Share the directory with user2
  3. With user2, upload a file and create a directory inside the shared directory.
  4. With user2, delete the file and the folder

There were errors happening in the acceptance tests (these steps are based on the failing test). It works fine with the PR.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE
@jvillafanez

Copy link
Copy Markdown
Member Author

@phil-davis any chance to test this PR with all the apps in order to prevent having to revert it if something goes wrong?

if (!$this->util->isExcluded($source)) {
$target = $this->getFullPath($path2);
if (isset($this->unencryptedSize[$source])) {
$this->unencryptedSize[$target] = $this->unencryptedSize[$source];

This comment was marked as spam.

@jvillafanez

Copy link
Copy Markdown
Member Author

ping

@IljaN IljaN left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need to check for exceptions as the files are always in a readable/acessible state between both operations. LGTM 👍

Restarting CI to check why it fails.

@ownclouders

ownclouders commented Dec 14, 2022

Copy link
Copy Markdown
Contributor

💥 Acceptance tests pipeline webUILogin-chrome-mariadb10.2-php7.4 failed. The build has been cancelled.

https://drone.owncloud.com/owncloud/core/37416/125

@IljaN

IljaN commented Dec 14, 2022

Copy link
Copy Markdown
Contributor

CI seems to non-deterministically fail on different steps on each re-start 🤔

@IljaN
IljaN force-pushed the encryption_copy_keys_first3 branch from 0d35d42 to 93ccf92 Compare December 15, 2022 10:54
@pako81

pako81 commented Dec 20, 2022

Copy link
Copy Markdown

The only test failing is related to fsweb.test.owncloud.com which is a known issue with this host, so it can be ignored.

@IljaN
IljaN self-requested a review December 21, 2022 11:57
@jnweiger
jnweiger merged commit 5dad1fc into master Dec 21, 2022
@delete-merged-branch
delete-merged-branch Bot deleted the encryption_copy_keys_first3 branch December 21, 2022 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

6 participants