Skip to content

occ files:scan does not invalidate checksums if file changed on disk. #23783

Closed

Description

@dragotin

Steps to reproduce

  1. Create a file on client
  2. Wait until it is synced.
  3. Check that it has a checksum in the database, which was sent from the client.
  4. Edit the file on the server file system, which is not supported and forbidden as you should know.
  5. Feel bad about yourself and think occ files:scan --all will fix it.
  6. Start occ files:scan --all as you are an experienced admin for ownCloud
  7. See that the checksum of the file has not changed and was not invalidated 👎

Expected behaviour

When a files mtime on disk is changed, the checksum on the server needs to be recalculated. If that can not be done, it needs at least to be invalidated. The occ file scan must compare the mtime of the file and the one stored in the db and wipe the checksum if they do not match. In addition there should be a switch to wipe all checksums, if they can not be recalculated.

Having a wrong checksum for a file is a critical problem as the client will complain about a corrupted file on download .

Server configuration

Operating system:
Linux
Web server:
apache
Database:
mysql
PHP version:
5.5.14
ownCloud version: (see ownCloud admin page)
9.0.x, master branch, 15833d9
Updated from an older ownCloud or fresh install:

Where did you install ownCloud from:
git
Are you using external storage, if yes which one: local/smb/sftp/...
no external storage
Are you using encryption: yes/no
no encryption
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
no user-backend.

Activity

  1. rullzer commented on Apr 4, 2016

    @rullzer
    Contributor

    Yes agreed this must be handled properly.
    I think the safest thing would even be to just invalidate all checksums on file scan. As we have (without recalculating) no guarantees the data is unchanged...

  2. danimo commented on Apr 4, 2016

    @danimo
    Contributor

    <sysadmin_hat>Safe? Yes. Expected: no. Scanning has become the default solution when something is wrong. Invalidating checksums by default makes this impossible, as it means resynch with all clients. Not something you want with a considerable amount of users and devices.</sysadmin_hat>

  3. rullzer commented on Apr 4, 2016

    @rullzer
    Contributor

    @danimo well if we don't want to calculate checksums on the server this is kind of playing with fire...

    I guess the 'second' safest thing to do it compare mtime + size...

  4. added this to the milestone on Apr 4, 2016
  5. rullzer commented on Apr 4, 2016

    @rullzer
    Contributor

    Raised to sev2 as this has to be fixed for 9.0.2 from my POV. @cmonteroluque

  6. dragotin commented on Apr 4, 2016

    @dragotin
    ContributorAuthor

    @danimo no, invalidating the checksums would not mean to resync to all clients, as we use the ETags to decide upon syncing as you remember.

    I think that there is no alternative to invalidating all checksums on rescan as, with this bug, we can not trust any checksum that is stored in the server db, as long as it is not validated.

  7. danimo commented on Apr 4, 2016

    @danimo
    Contributor

    @dragotin you are right, of course.

  8. 7 remaining items

  9. rullzer commented on Apr 19, 2016

    @rullzer
    Contributor

    PR that fixes this in #24098

  10. rullzer commented on Apr 20, 2016

    @rullzer
    Contributor

    Stable 9 backport in #24129

  11. rullzer commented on Apr 21, 2016

    @rullzer
    Contributor

    Merged. Closing.

  12. modified the milestones: , on Apr 21, 2016
  13. lock commented on Aug 4, 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.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions