Skip to content

[Bug]: adding a share-link breaks encryption after upgrade to v27 #39429

Description

@dsweberr

⚠️ This issue respects the following points: ⚠️

Bug description

adding a share via link to existing files breaks encryption by deleting all encryption keys

https://github.com/nextcloud/server/blob/v27.0.0/apps/encryption/lib/Crypto/Encryption.php#L444
$this->path is empty and causes exception after deleting all keys in #L441

changing to $path appears to fix the issue

Steps to reproduce

enable encryption, do multiple major version upgrades, add share via link to file

Expected behavior

link to file should work and not break existing files

Installation method

Community Manual installation with Archive

Nextcloud Server version

27

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 22 to 23)

Are you using the Nextcloud Server Encryption module?

Encryption is Enabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

"exception": {
        "Exception": "BadMethodCallException",
        "Message": "path needs to be relative to the system wide data folder and point to a user specific file",
        "Code": 0,
        "Trace": [
            {
                "file": "/var/www/nextcloud/lib/private/Encryption/Keys/Storage.php",
                "line": 366,
                "function": "getUidAndFilename",
                "class": "OC\\Encryption\\Util",
                "type": "->"
            },
            {
                "file": "/var/www/nextcloud/lib/private/Encryption/Keys/Storage.php",
                "line": 138,
                "function": "getFileKeyDir",
                "class": "OC\\Encryption\\Keys\\Storage",
                "type": "->"
            },
            {
                "file": "/var/www/nextcloud/apps/encryption/lib/KeyManager.php",
                "line": 381,
                "function": "setFileKey",
                "class": "OC\\Encryption\\Keys\\Storage",
                "type": "->"
            },
            {
                "file": "/var/www/nextcloud/apps/encryption/lib/Crypto/Encryption.php",
                "line": 444,
                "function": "setShareKey",
                "class": "OCA\\Encryption\\KeyManager",
                "type": "->"
            },
---
call to setShareKey() with empty path

Additional info

No response

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions