nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.91k stars 4.02k forks source link

Error: Couldn't re-calculate unencrypted size for files_versions #28959

Closed hiikii closed 1 year ago

hiikii commented 3 years ago

How to use GitHub

Steps to reproduce

  1. NextCloud file encryption is enabled, add an S3 bucket to the external storage and set it to not be encrypted
  2. Upload some files to external storage via WebDAV
  3. Modify these uploaded files and re-upload via WebDAV
  4. There is no problem with the updated file, but two messages will be seen in the NextCloud log: OC\ServerNotAvailableException: Legacy cipher is no longer supported! / Couldn't re-calculate unencrypted size for files_versions

Expected behaviour

The version file should be correctly identified as an unencrypted file.

Actual behaviour

NextCloud seems to think this is an encrypted file and tells the user that Legacy cipher is no longer supported.

Server configuration

Operating system: Debian 11

Web server: Nginx

Database: MariaDB

PHP version: 8.0.9

Nextcloud version: 22.1.1

Updated from an older Nextcloud/ownCloud or fresh install: Updated from Nextcloud 21.0.4

Where did you install Nextcloud from: Use the official installation package

Signing status:

Signing status ``` No errors have been found. ```

List of activated apps:

App list ``` Enabled: - accessibility: 1.7.0 - activity: 2.15.0 - calendar: 2.3.3 - circles: 22.1.1 - cloud_federation_api: 1.4.0 - comments: 1.11.0 - contacts: 4.0.3 - contactsinteraction: 1.2.0 - dashboard: 7.1.0 - dav: 1.18.0 - encryption: 2.9.0 - federatedfilesharing: 1.11.0 - federation: 1.11.0 - files: 1.16.0 - files_accesscontrol: 1.12.0 - files_external: 1.12.1 - files_pdfviewer: 2.3.0 - files_rightclick: 1.1.0 - files_sharing: 1.13.2 - files_trashbin: 1.11.0 - files_versions: 1.14.0 - files_videoplayer: 1.11.0 - firstrunwizard: 2.11.0 - logreader: 2.7.0 - lookup_server_connector: 1.9.0 - mail: 1.10.4 - nextcloud_announcements: 1.11.0 - notifications: 2.10.1 - oauth2: 1.9.0 - password_policy: 1.12.0 - photos: 1.4.0 - privacy: 1.6.0 - provisioning_api: 1.11.0 - recommendations: 1.1.0 - serverinfo: 1.12.0 - settings: 1.3.0 - sharebymail: 1.11.0 - support: 1.5.0 - survey_client: 1.10.0 - systemtags: 1.11.0 - text: 3.3.0 - theming: 1.12.0 - twofactor_backupcodes: 1.10.1 - updatenotification: 1.11.0 - user_status: 1.1.1 - viewer: 1.6.0 - workflowengine: 2.3.1 Disabled: - admin_audit - bruteforcesettings - files_versions_s3 - richdocuments - spreed - user_ldap - weather_status ```

Nextcloud configuration:

Config report ``` { "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "version": "22.1.1.2", "overwrite.cli.url": "", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "memcache.local": "\\OC\\Memcache\\Redis", "memcache.distributed": "\\OC\\Memcache\\Redis", "filelocking.enabled": true, "memcache.locking": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 6379, "dbindex": 0, "timeout": 1.5 }, "appcodechecker": true, "maintenance": false, "theme": "", "loglevel": 2, "updater.release.channel": "stable", "versions_retention_obligation": "auto, 30" }, "apps": { "accessibility": { "enabled": "yes", "installed_version": "1.7.0", "types": "" }, "activity": { "enabled": "yes", "installed_version": "2.15.0", "types": "filesystem" }, "audioplayer": { "enabled": "no", "installed_version": "3.1.0", "types": "filesystem" }, "backgroundjob": { "lastjob": "511" }, "bruteforcesettings": { "installed_version": "2.2.0", "types": "" }, "calendar": { "enabled": "yes", "installed_version": "2.3.3", "types": "" }, "circles": { "enabled": "yes", "installed_version": "22.1.1", "loopback_tmp_scheme": "https", "maintenance_run": "0", "maintenance_update": "{\"maximum\":3,\"3\":1632573302,\"2\":1632574502,\"1\":1632574502,\"4\":1632535202,\"5\":1632366002}", "types": "filesystem,dav" }, "cloud_federation_api": { "enabled": "yes", "installed_version": "1.4.0", "types": "filesystem" }, "comments": { "enabled": "yes", "installed_version": "1.11.0", "types": "logging" }, "contacts": { "enabled": "yes", "installed_version": "4.0.3", "types": "dav" }, "contactsinteraction": { "enabled": "yes", "installed_version": "1.2.0", "types": "dav" }, "core": { "backgroundjobs_mode": "cron", "default_encryption_module": "OC_DEFAULT_MODULE", "encryption_enabled": "yes", "installedat": "1611579874.009", "lastcron": "1632574502", "lastupdateResult": "[]", "lastupdatedat": "1632574127", "moveavatarsdone": "yes", "oc.integritycheck.checker": "[]", "previewsCleanedUp": "1", "public_files": "files_sharing\/public.php", "public_webdav": "dav\/appinfo\/v1\/publicwebdav.php", "theming.variables": "b92d206521717ac032f8aa58d3c7ff2f", "updater.secret.created": "1632330426", "vendor": "nextcloud" }, "dashboard": { "enabled": "yes", "installed_version": "7.1.0", "types": "" }, "dav": { "buildCalendarReminderIndex": "yes", "buildCalendarSearchIndex": "yes", "chunks_migrated": "1", "enabled": "yes", "installed_version": "1.18.0", "regeneratedBirthdayCalendarsForYearFix": "yes", "types": "filesystem" }, "encryption": { "enabled": "yes", "installed_version": "2.9.0", "masterKeyId": "master_5189cf13", "publicShareKeyId": "pubShare_5189cf13", "recoveryKeyId": "recoveryKey_5189cf13", "types": "filesystem" }, "federatedfilesharing": { "enabled": "yes", "installed_version": "1.11.0", "types": "" }, "federation": { "enabled": "yes", "installed_version": "1.11.0", "types": "authentication" }, "files": { "enabled": "yes", "installed_version": "1.16.0", "types": "filesystem" }, "files_accesscontrol": { "enabled": "yes", "installed_version": "1.12.0", "types": "filesystem" }, "files_external": { "allow_user_mounting": "yes", "enabled": "yes", "installed_version": "1.12.1", "types": "filesystem", "user_mounting_backends": "ftp,dav,owncloud,sftp,amazons3,swift,\\OC\\Files\\Storage\\SFTP_Key" }, "files_pdfviewer": { "enabled": "yes", "installed_version": "2.3.0", "types": "" }, "files_rightclick": { "enabled": "yes", "installed_version": "1.1.0", "types": "" }, "files_sharing": { "enabled": "yes", "installed_version": "1.13.2", "types": "filesystem" }, "files_trashbin": { "enabled": "yes", "installed_version": "1.11.0", "types": "filesystem,dav" }, "files_versions": { "enabled": "yes", "installed_version": "1.14.0", "types": "filesystem,dav" }, "files_versions_s3": { "enabled": "no", "installed_version": "0.1.6", "types": "filesystem" }, "files_videoplayer": { "enabled": "yes", "installed_version": "1.11.0", "types": "" }, "firstrunwizard": { "enabled": "yes", "installed_version": "2.11.0", "types": "logging" }, "logreader": { "enabled": "yes", "installed_version": "2.7.0", "live": "1", "types": "" }, "lookup_server_connector": { "enabled": "yes", "installed_version": "1.9.0", "types": "authentication" }, "mail": { "enabled": "yes", "installed_version": "1.10.4", "types": "" }, "music": { "enabled": "no", "installed_version": "1.2.1", "types": "filesystem" }, "nextcloud_announcements": { "enabled": "yes", "installed_version": "1.11.0", "pub_date": "Thu, 24 Oct 2019 00:00:00 +0200", "types": "logging" }, "notifications": { "enabled": "yes", "installed_version": "2.10.1", "types": "logging" }, "oauth2": { "enabled": "yes", "installed_version": "1.9.0", "types": "authentication" }, "password_policy": { "enabled": "yes", "installed_version": "1.12.0", "types": "authentication" }, "photos": { "enabled": "yes", "installed_version": "1.4.0", "types": "" }, "privacy": { "enabled": "yes", "fullDiskEncryptionEnabled": "0", "installed_version": "1.6.0", "types": "" }, "provisioning_api": { "enabled": "yes", "installed_version": "1.11.0", "types": "prevent_group_restriction" }, "recommendations": { "enabled": "yes", "installed_version": "1.1.0", "types": "" }, "richdocuments": { "enabled": "no", "installed_version": "4.2.2", "types": "filesystem,dav,prevent_group_restriction" }, "serverinfo": { "cached_count_filecache": "44867", "cached_count_storages": "4", "enabled": "yes", "installed_version": "1.12.0", "types": "" }, "settings": { "enabled": "yes", "installed_version": "1.3.0", "types": "" }, "sharebymail": { "enabled": "yes", "installed_version": "1.11.0", "types": "filesystem" }, "spreed": { "enabled": "no", "installed_version": "11.3.1", "project_access_invalidated": "1", "types": "dav,prevent_group_restriction" }, "support": { "SwitchUpdaterServerHasRun": "yes", "enabled": "yes", "installed_version": "1.5.0", "types": "session" }, "survey_client": { "enabled": "yes", "installed_version": "1.10.0", "types": "" }, "systemtags": { "enabled": "yes", "installed_version": "1.11.0", "types": "logging" }, "text": { "enabled": "yes", "installed_version": "3.3.0", "types": "dav" }, "theming": { "enabled": "yes", "installed_version": "1.12.0", "types": "logging" }, "twofactor_backupcodes": { "enabled": "yes", "installed_version": "1.10.1", "types": "" }, "updatenotification": { "calendar": "2.3.3", "contacts": "4.0.3", "core": "22.1.1.2", "enabled": "yes", "installed_version": "1.11.0", "mail": "1.10.4", "types": "", "update_check_errors": "0" }, "user_status": { "enabled": "yes", "installed_version": "1.1.1", "types": "" }, "viewer": { "enabled": "yes", "installed_version": "1.6.0", "types": "" }, "weather_status": { "enabled": "no", "installed_version": "1.1.0", "types": "" }, "workflowengine": { "enabled": "yes", "installed_version": "2.3.1", "types": "filesystem" } } } ```

Are you using external storage, if yes which one: Amazon S3 (Backblaze)

Are you using encryption: yes

Are you using an external user-backend, if yes which one: Webdav

Client configuration

Browser: Firefox

Operating system: Windows

Logs

Web server error log

Web server error log ``` no error here ```

Nextcloud log (data/nextcloud.log)

Nextcloud log1 ``` {"reqId":"cSojZzL7k3OTQLazgxwJ","level":3,"time":"2021-09-25T12:45:01+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Legacy cipher is no longer supported!","userAgent":"--","version":"22.1.1.2","exception":{"Exception":"OC\\ServerNotAvailableException","Message":"Legacy cipher is no longer supported!","Code":0,"Trace":[{"file":"/home/www/nextcloud/apps/encryption/lib/Crypto/Encryption.php","line":237,"function":"getLegacyCipher","class":"OCA\\Encryption\\Crypto\\Crypt","type":"->"},{"file":"/home/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php","line":582,"function":"begin","class":"OCA\\Encryption\\Crypto\\Encryption","type":"->"},{"file":"/home/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php","line":503,"function":"fixUnencryptedSize","class":"OC\\Files\\Storage\\Wrapper\\Encryption","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php","line":168,"function":"verifyUnencryptedSize","class":"OC\\Files\\Storage\\Wrapper\\Encryption","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":156,"function":"filesize","class":"OC\\Files\\Storage\\Wrapper\\Encryption","type":"->"},{"file":"/home/www/nextcloud/lib/private/Files/View.php","line":1171,"function":"filesize","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/home/www/nextcloud/lib/private/Files/View.php","line":414,"function":"basicOperation","class":"OC\\Files\\View","type":"->"},{"file":"/home/www/nextcloud/apps/files_versions/lib/Storage.php","line":581,"function":"filesize","class":"OC\\Files\\View","type":"->"},{"file":"/home/www/nextcloud/apps/files_versions/lib/Storage.php","line":492,"function":"getAllVersions","class":"OCA\\Files_Versions\\Storage","type":"::"},{"file":"/home/www/nextcloud/apps/files_versions/lib/BackgroundJob/ExpireVersions.php","line":65,"function":"expireOlderThanMaxForUser","class":"OCA\\Files_Versions\\Storage","type":"::"},{"file":"/home/www/nextcloud/lib/private/User/Manager.php","line":646,"function":"OCA\\Files_Versions\\BackgroundJob\\{closure}","class":"OCA\\Files_Versions\\BackgroundJob\\ExpireVersions","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/www/nextcloud/apps/files_versions/lib/BackgroundJob/ExpireVersions.php","line":66,"function":"callForSeenUsers","class":"OC\\User\\Manager","type":"->"},{"file":"/home/www/nextcloud/lib/private/BackgroundJob/Job.php","line":51,"function":"run","class":"OCA\\Files_Versions\\BackgroundJob\\ExpireVersions","type":"->"},{"file":"/home/www/nextcloud/lib/private/BackgroundJob/TimedJob.php","line":58,"function":"execute","class":"OC\\BackgroundJob\\Job","type":"->"},{"file":"/home/www/nextcloud/cron.php","line":127,"function":"execute","class":"OC\\BackgroundJob\\TimedJob","type":"->"}],"File":"/home/www/nextcloud/apps/encryption/lib/Crypto/Crypt.php","Line":300,"CustomMessage":"--"},"id":"614f20d8c58b2"} ```
Nextcloud log2 ``` {"reqId":"cSojZzL7k3OTQLazgxwJ","level":3,"time":"2021-09-25T12:45:01+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Couldn't re-calculate unencrypted size for files_versions/CMove/Home/test.v1632467378","userAgent":"--","version":"22.1.1.2","id":"614f20d8c58c0"} ```

Browser log

Browser log ``` no erro here ```
szaimen commented 1 year ago

Hi, please update to 24.0.9 or better 25.0.3 and report back if it fixes the issue. Thank you!

My goal is to add a label like e.g. 25-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!

If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+