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

Cannot export-delete-import local storage with encryption on #203

Open
phil-davis opened this issue Jun 12, 2020 · 0 comments
Open

Cannot export-delete-import local storage with encryption on #203

phil-davis opened this issue Jun 12, 2020 · 0 comments

Comments

@phil-davis
Copy link
Contributor

e.g. see scenarios add in core PR owncloud/core#37513

  • have master key encryption
  • create some local storage mount
  • upload a file into the local storage (all is good, it can be seen and downloaded)
  • files_external:export the local storage mount settings
  • files_external:delete the local storage mount (leaving the files still in the local storage folder but they are now not visible to ownCloud users)
  • files_external:import the local storage mount to create it again
  • try to download the file
  Background:                                                                               # /var/www/owncloud/testrunner/tests/acceptance/features/cliLocalStorage/importLocalStorage.feature:7
    Given these users have been created with default attributes and without skeleton files: # FeatureContext::theseUsersHaveBeenCreatedWithDefaultAttributesAndWithoutSkeletonFiles()
      | username |
      | Alice    |

  Scenario: import local storage mounts from a file                                                                                         # /var/www/owncloud/testrunner/tests/acceptance/features/cliLocalStorage/importLocalStorage.feature:12
    Given the administrator has created the local storage mount "local_storage2"                                                            # OccContext::theAdministratorHasCreatedTheLocalStorageMountUsingTheOccCommand()
    And the administrator has uploaded file with content "this is a file in local storage2" to "/local_storage2/file-in-local-storage2.txt" # FeatureContext::adminHasUploadedAFileWithContentTo()
    And the administrator has exported the local storage mounts using the occ command                                                       # OccContext::theAdministratorHasExportedTheMountsUsingTheOccCommand()
    And the administrator has created a file "data/exportedMounts.json" with the last exported content using the testing API                # FeatureContext::theAdministratorHasCreatedAFileWithLastExportedContent()
    And the administrator has deleted local storage "local_storage" using the occ command                                                   # OccContext::administratorHasDeletedLocalStorageFolderUsingTheOccCommand()
    And the administrator has deleted local storage "local_storage2" using the occ command                                                  # OccContext::administratorHasDeletedLocalStorageFolderUsingTheOccCommand()
    When the administrator imports the local storage mount from file "data/exportedMounts.json" using the occ command                       # OccContext::theAdministratorImportsTheMountFromFileUsingTheOccCommand()
    And the administrator lists the local storage using the occ command                                                                     # OccContext::adminListsLocalStorageMountUsingTheOccCommand()
    Then the following local storage should be listed:                                                                                      # OccContext::theFollowingLocalStorageShouldBeListed()
      | MountPoint      | Storage | AuthenticationType | Configuration | Options | ApplicableUsers | ApplicableGroups |
      | /local_storage2 | Local   | None               | datadir:      |         | All             |                  |
    And as "Alice" folder "/local_storage2" should exist                                                                                    # FeatureContext::asFileOrFolderShouldExist()
    And the content of file "/local_storage2/file-in-local-storage2.txt" for user "Alice" should be "this is a file in local storage2"      # FeatureContext::contentOfFileForUserShouldBe()
      The downloaded content was expected to be 'this is a file in local storage2', but actually is '<?xml version="1.0" encoding="utf-8"?>
      <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
        <s:exception>OC\HintException</s:exception>
        <s:message>Bad Signature</s:message>
      </d:error>
      '.
      Failed asserting that two strings are equal.
      --- Expected
      +++ Actual
      @@ @@
      -'this is a file in local storage2'
      +'<?xml version="1.0" encoding="utf-8"?>\n
      +<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">\n
      +  <s:exception>OC\HintException</s:exception>\n
      +  <s:message>Bad Signature</s:message>\n
      +</d:error>\n
      +'

You get a "Bad Signature" exception.

I guess that the file was encrypted on the original upload, but after recreating the local storage mount some information needed to decrypt it is now different/wrong.

Maybe this is "expected behavior" and before doing this sort of thing the files should be downloaded somewhere in unencrypted form, and then uploaded again when the local storage mount is recreated. Or?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant