Skip to content

File Transport Checksums Between Server and Desktop #3735

Closed

Description

@MTRichards

As an ownCloud admin, I want ownCloud to ensure that files transported from the desktop client to the server are not corrupted in transit so that we can catch bugs and avoid corrupting customer data

Acceptance Criteria:

  • Desktop sync client takes a checksum of files on the desktop when they are discovered and stores the checksum in the database
  • When the file is transmitted to the ownCloud server, the checksum is also transmitted
  • The server checksums the file when it arrives at the server, compares it to the checksum transmitted by the client previously
  • If the checksums match, a success return code is sent
  • If the chechsums fail to match, the file has been corrupted and the desktop skips that file. The file will be retransmitted on the next upload.
  • If the file is corrupted in transit, the file transfer log on the desktop reflects that this file was corrupted in transit, and that it will be retried on the next sync run
    Note: this links to server issue XXX

Activity

  1. added this to the milestone on Sep 2, 2015
  2. self-assigned this
    on Sep 7, 2015
  3. added
    p2-high
    on Sep 30, 2015
  4. ckamm commented on Oct 1, 2015

    @ckamm
    Contributor

    What needs to be done in the client?

    • Determine whether the server accepts checksums, possibly via capabilities. Currently checksumming needs to be explicitly enabled in the config file.
    • Store checksums in the database. (for performance optimization only, I guess?)
    • Check that checksum errors are handled nicely.
  5. ckamm commented on Oct 14, 2015

    @ckamm
    Contributor

    We also need to make sure getting an empty checksum header from the server during downloads isn't considered a validation failure - currently that seems to be the case. I wonder why b05ca52 did that -- @dragotin?

  6. dragotin commented on Oct 14, 2015

    @dragotin
    Contributor

    @ckamm the patch you're pointing to checks the expected checksum type as in Adler32 or SHA or so. If that is empty, we do not have checksumming and assume validated() - which means all is ok.

  7. ckamm commented on Oct 14, 2015

    @ckamm
    Contributor

    @dragotin Yes, but why would the checksum type configured in the config file matter when one validates a checksum the server sends?

    And shouldn't an empty checksum header still yield validated? It sounds like only files that were uploaded by new clients will have checksums when using the owncloud server.

  8. assigned and unassigned on Oct 14, 2015
  9. ckamm commented on Oct 15, 2015

    @ckamm
    Contributor

    @moscicki I'm touching the checksumming code and wonder: Do you use Adler32 or ADLER32? What does the server accept and what does it send? I'd prefer to just use one spelling and there's a small chance you're requiring one for uploads and the other for downloads...

  10. 64 remaining items

  11. ckamm commented on Jan 19, 2016

    @ckamm
    Contributor

    @bboule Are you saying you're currently working on this? Should I assign this to you?

  12. MorrisJobke commented on Jan 19, 2016

    @MorrisJobke
    Contributor

    @bboule Are you saying you're currently working on this? Should I assign this to you?

    I don't think so. This is just a label of the tool he is using 🙈

  13. ckamm commented on Jan 19, 2016

    @ckamm
    Contributor

    @MorrisJobke Thanks, that explains it. As far as I know, testing this can only start when owncloud/core#18716 is done.

  14. rullzer commented on Jan 29, 2016

    @rullzer
    Contributor

    See owncloud/core#21997 for a WIP PR... it can store provided checksums from the OC-Checksum Header. Will return the OC-Checksum header if there is a checksum. And on propfind the checksums will be returned as well <oc:checksums>

    The format for the header field is basically: <TYPE>:<CHECKSUM>(, <TYPE>:<CHECKSUM>)*

  15. rullzer commented on Feb 3, 2016

    @rullzer
    Contributor

    owncloud/core#21997 is in. However slimmed down. So right now only 1 checksum can be send.

    But all should work for 9.0

  16. dragotin commented on Feb 19, 2016

    @dragotin
    Contributor

    The acceptance criteria of this issue is not met as the server in the current implementation (9.0) does not validate the checksum that comes with the client's file upload, but only stores it.

    In fact, with that we only have file transport verification only on downloads. Also the server stores checksums without verifying them against the uploaded file first.

  17. DeepDiver1975 commented on Feb 23, 2016

    @DeepDiver1975
    Contributor

    The server checksums the file when it arrives at the server, compares it to the checksum transmitted by the client previously
    If the checksums match, a success return code is sent
    If the chechsums fail to match, the file has been corrupted and the desktop skips that file. The file will be retransmitted on the next upload.

    these criteria above should have been added to the corresponding server ticket owncloud/core#18716

    @MTRichards @karlitschek @cmonteroluque this somehow got lost while coordinating client and server requirements - hopefully we can avoid this in the future

  18. dragotin commented on Feb 29, 2016

    @dragotin
    Contributor

    for the sake of completeness, here is the current state with 9.0.

    With not having the server verifying the uploaded checksum, this can happen:

        1. UserA uploads a file to the server with checksumA. 
        2. FIle gets corrupted during transport
        3. Server stores corrupted file and checksumA.
        4. UserB downloads the file and checksum and they don't match.
        5. UserB will invalidate the file, redownload.
    

    At the same time UserA thinks his file is properly upload to the server. Which is not the case.

  19. mcastroSG commented on May 11, 2016

    @mcastroSG

    Hi hi:

    Test 1

    Steps Executed

    1.- Connect desktop client to a server that has cksum capabilities enabled
    2.- Copy a big file (at least 50Mb) to Shared sync folder
    3.- While syncing connect to server and modify any chunk adding some characters to be sure that final cksum and initial cksum does not match

    Results

    Right now as could be expected server does not validate cksum at uploads so in this case we could have a corrupted file updated to the server what is described right above could happend.

    Test 2

    Steps Executed

    1.- Connect desktop client to a server that has cksum capabilities enabled
    2.- Add a file1 to Shared sync folder
    3.- Wait till sync is done
    4.- Connect to server DB and update checksum value at filecache table for the file we have uploaded at step 3
    5.- Remove connection and add a new connection to the same server

    Results

    An error is raised to let us know that the file1 does not match expected cksum and sync for that file ir retried at next sync.

    Test 3

    Steps executed

    1.- Connect desktop client to a server that has cksum capabilities enabled
    2.- Add a file2.eml to Shared Sync folder
    3.- Wait till sync ends
    4.- touch file2.eml
    5.- Wait till sync ends again

    Results

    File2 is not synced again.

    Test 4

    Steps executed

    1.- Connect desktop client to a server that has cksum capabilities enabled
    2.- Add a file2.txt to Shared Sync folder
    3.- Wait till sync ends
    4.- touch file2.txt
    5.- Wait till sync ends again

    Results

    File2.txt is uploaded again.

    Test 5

    Steps executed

    1.- Connect desktop client to a server that has cksum capabilities enabled
    2.- Add several files to Shared sync folder
    3.- Wait till sync ends
    4.- Check at DB that checksum stored matches with local checksum, i.e. md5

    Results

    It works fine, checksum matches.

    @dragotin what do you think we can do with this issue ¿?

    ServerOS: Ubuntu
    Server Version: 9.1.0 Alpha modified to add cksum capabilities

    Client OS: OS X El capitán 10.11.4
    Client Version: Version 2.2.0rc1 (build 3346)

  20. dragotin commented on May 11, 2016

    @dragotin
    Contributor

    @mcastroSG very good work, all tests make sense and succeed. Thanks. I think you can close this.

  21. mcastroSG commented on May 11, 2016

    @mcastroSG

    Thanks a lot !! 😃

  22. meekjt commented on May 15, 2016

    @meekjt

    What is the config option for enabling support of file transport checksums on the server side? It does not seem to be documented anywhere.

  23. danimo commented on May 15, 2016

    @danimo
    Contributor

    @meekjt The option is not there yet on the server side. It will come with one of the next versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ReadyToTestServer Involvedblue-ticketp2-high

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions