Skip to content

Store client's file checksum as metadata and return it again in downloads and PROPFIND #18716

Closed

Description

@karlitschek

We want to handle checksums in webdav requests.

Goals:

  • secure the webdav/http transport layer
  • partly secure again corruption on the storage layer

Limitations:

  • files are uploaded and created from several different sides. for example directly on the external storage. Because of that checksum are not always available or there generation would be too expensive. Because of that there are sometimes available and sometimes not. So checksums will be optional

Approach:

  • Everytime a clients who supports this feature. (the ownCloud Desktop Client in the first step) can send a checksum of the file in parallel with the payload.
  • The ownCloud server stores this checksum in the file cache table
  • If a checksum for a file is available in the filecache table then this value is returned with every propfind.
  • The client can then compare the checksum and detect possible corruption of the file.
  • In this first step of the checksumming no checksums are generated on the server side. The server acts purely as a storage at the moment. In the later stage this could be extended.

Because checksums are not always available and are completely optional the clients can't rely on them for the actual syncing algorithm.

This approach can be extended in different directions in the future but we should start with this step.


QA ticket: owncloud/QA#113
Documentation ticket: https://github.com/owncloud/documentation/issues/2132

Activity

  1. karlitschek commented on Aug 31, 2015

    @karlitschek
    ContributorAuthor
  2. karlitschek commented on Aug 31, 2015

    @karlitschek
    ContributorAuthor
  3. added this to the milestone on Aug 31, 2015
  4. aspdye commented on Aug 31, 2015

    @aspdye

    👍

  5. PVince81 commented on Sep 16, 2015

    @PVince81
    Contributor

    Sounds great 😄

  6. ckamm commented on Oct 1, 2015

    @ckamm

    The client-side ticket is owncloud/client#3735. When this is added to the server, please also add a list of supported checksumming algorithms to the capabilities API. The client currently supports "Adler32", "MD5" and "SHA1".

    You can already ask the client to send checksums for uploads by adding transmissionChecksum=MD5 to the [General] section of owncloud.cfg.

  7. changed the title [-]checksum support[/-] [+]Store client's file checksum as metadata and return it again[/+] on Oct 2, 2015
  8. changed the title [-]Store client's file checksum as metadata and return it again[/-] [+]Store client's file checksum as metadata and return it again in downloads and PROPFIND[/+] on Oct 2, 2015
  9. self-assigned this
    on Oct 14, 2015
  10. dragotin commented on Oct 19, 2015

    @dragotin
    Contributor

    I would suggest that both client and server work with a HTTP header of the form:

    OC-Checksum: <checksum-type>:<sum>
    

    Currently we support the checksum types MD5, SHA1 and Adler32

  11. PVince81 commented on Dec 7, 2015

    @PVince81
    Contributor

    @dragotin is the client already sending something ?

    TODO for the server:

    • enhance the FilesPlugin to return the stored checksum in a new "oc:checksum" attribute (for PROPFIND)
    • make sure the attribute CANNOT be set using PROPPATCH, but only through a legitimate upload
    • at upload time, if "OC-Checksum" header is set, store it
    • where to store it ? new filecache table column ? CC @icewind1991
  12. dragotin commented on Dec 7, 2015

    @dragotin
    Contributor

    yes, since 2.1.0 the client sends either Adler32 (probably not useful), MD5 or SHA1 if you enable it in the config file by setting:

    transmissionChecksum=MD5
    

    in the [General] section.

  13. icewind1991 commented on Dec 7, 2015

    @icewind1991
    Contributor

    where to store it ? new filecache table column

    I would say so yes

  14. 1 remaining item

  15. PVince81 commented on Dec 7, 2015

    @PVince81
    Contributor

    Regarding filecache table: I heard that adding a column on an existing table that has 10K or more entries might be slow at update time. So we might also need to consider a separate table.
    But I'm not database expert. 😄

  16. dragotin commented on Dec 7, 2015

    @dragotin
    Contributor

    I'd suggest a detail table with colums fileId, checksumtypeId and checksum, with primary key (fileId, checksumtype) and another detail table mapping checksumtypeId to a meaningful string.

  17. icewind1991 commented on Dec 8, 2015

    @icewind1991
    Contributor

    I'd suggest a detail table with colums fileId, checksumtypeId and checksum, with primary key (fileId, checksumtype) and another detail table mapping checksumtypeId to a meaningful string.

    Makes more sense yes

  18. DeepDiver1975 commented on Dec 8, 2015

    @DeepDiver1975
    Contributor

    Regarding filecache table: I heard that adding a column on an existing table that has 10K or more entries might be slow at update time.

    should be of lesser issue if the column is nullable

  19. added
    p2-high
    on Dec 11, 2015
  20. rullzer commented on Feb 3, 2016

    @rullzer
    Contributor
  21. rullzer commented on Feb 8, 2016

    @rullzer
    Contributor

    Closing time :)

  22. MorrisJobke commented on Feb 9, 2016

    @MorrisJobke
    Contributor

    Proper return values for multiple checksums went in as #22199

  23. dragotin commented on Feb 18, 2016

    @dragotin
    Contributor

    Just for the record:

    So far, the client never asks for the checksum in PROPFINDs. As a result, the checksum is never returned in a PROPFIND result and thus does not need to be read from database for the normal PROPFIND usecase.

    For the current functionality, the client does not need the content checksum at all. So far we agreed to only use the checksum for transportation verification. For that, the checksum is contained in a HTTP header of the PUT or GET request, and from there the client is reading it.

    For change detection of server files, we continue to rely on the ETags which makes sense. So I currently see no reason why the client would EVER ask for the checksum of the whole file in a PROPFIND. It is very good to have that for special cases but not for the normal case.

    Let me kindly ask for re-considering to store multiple checksums in a detail table rather than in one column in oc_filecache given these facts.

  24. bugsyb commented on Feb 18, 2016

    @bugsyb

    Even if it is outside of this feature, it would be good to have
    implemented checksum verification by client as an additional option on
    top of ETags (or in parallel).

    Dreaming further, it would be good to be able to sync differences within
    files only (using rolling checksum window, similar to DropBox and rsync).

    Regards,
    David

    On 2016-02-18 11:26, Klaas Freitag wrote:

    Just for the record:

    So far, the client never asks for the checksum in PROPFINDs. As a
    result, the checksum is never returned in a PROPFIND result and thus
    does not need to be read from database for the normal PROPFIND usecase.

    For the current functionality, the client does not need the content
    checksum at all. So far we agreed to only use the checksum for
    transportation verification. For that, the checksum is contained in a
    HTTP header of the PUT or GET request, and from there the client is
    reading it.

    For change detection of server files, we continue to rely on the ETags
    which makes sense. So I currently see no reason why the client would
    EVER ask for the checksum of the whole file in a PROPFIND. It is very
    good to have that for special cases but not for the normal case.

    Let me kindly ask for re-considering to store multiple checksums in a
    detail table rather than in one column in oc_filecache given these facts.

    —
    Reply to this email directly or view it on GitHub
    #18716 (comment).

  25. DeepDiver1975 commented on Feb 18, 2016

    @DeepDiver1975
    Contributor

    After further discussion with @dragotin we will for now keep the current approach because it is simply enough for what we are trying to accomplish for 9.0

    Even if storage backends can provide multiple checksums - the question is if we really need to store them in out database.

    Assuming we once want to verify the checksums between owncloud and the storage system - I see no need in storing them because the checksums are only evaluated on upload to the storage.

    The checksum send from/to the client is for a different scenarios/part of the workflow.

  26. dragotin commented on Mar 29, 2016

    @dragotin
    Contributor

    I think this is the important bit to fix #11811

  27. lock commented on Aug 5, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  28. locked as resolved and limited conversation to collaborators on Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementoverviewp2-high

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions