nextcloud / nextcloud/server

[Bug]: Changed access rights after deleting and restoring

Open
#62,233 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 34-feedback bug feature: trashbin
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

If you delete a file/folder by Web-GUI and restore it, access rights in DB are changed. Mostly of only this folder, sometimes bug will inherit to upper folder.

Steps to reproduce
  1. Open Web-GUI
  2. Delete Folder/File
  3. Goto Deleted Files
  4. Restore Folder/File
  5. Go to all files again
  6. Try to access restored Folder/File --> should not work.
  7. Goto DB: SELECT fileid, path, permissions FROM oc_filecache WHERE path = 'files/';
  8. If file/folder permission is 24 --> buggy, should be 31.
Expected behavior
  1. Open Web-GUI
  2. Delete Folder/File
  3. Goto Deleted Files
  4. Restore Folder/File
  5. Access Folder/File as usual
Nextcloud Server version

34

Operating system

Other

PHP engine version

None

Web server

None

Database engine version

None

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

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
# sudo -u www-data php occ config:list system
php occ config:list system
./occ config:list system/bin/sh: 1: sudo: not found
# {
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "bulkupload.enabled": false,
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwriteprotocol": "https",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "upgrade.disable-web": true,
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "34.0.1.2",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "preview_imaginary_url": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpauth": true,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "loglevel": 3,
        "maintenance": false,
        "maintenance_window_start": 1,
        "default_phone_region": "AT",
        "server_id": {
            "\/var\/www\/html\/occ": {
                "config:system:set": {
                    "server_id": "nextcloud-spendier-01"
                }
            }
        },
        "trusted_domains": [
            "127.0.0.1",
            "localhost",
            "nextcloud",
            "nextcloud.lan",
            "nextcloud.lan:30027",
            "nextcloud.spendier.at",
            "nginx"
        ]
    }
}
# 
{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "bulkupload.enabled": false,
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwriteprotocol": "https",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "upgrade.disable-web": true,
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "34.0.1.2",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "preview_imaginary_url": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpauth": true,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "loglevel": 3,
        "maintenance": false,
        "maintenance_window_start": 1,
        "default_phone_region": "AT",
        "server_id": {
            "\/var\/www\/html\/occ": {
                "config:system:set": {
                    "server_id": "nextcloud-spendier-01"
                }
            }
        },
        "trusted_domains": [
            "127.0.0.1",
            "localhost",
            "nextcloud",
            "nextcloud.lan",
            "nextcloud.lan:30027",
            "nextcloud.spendier.at",
            "nginx"
        ]
    }
}
#
List of activated Apps
# sudo -u www-data php occ app:list
php occ app:list
./occ app:list/bin/sh: 35: sudo: not found
# Enabled:
  - appstore: 1.0.0
  - bruteforcesettings: 7.0.0
  - cloud_federation_api: 1.18.0
  - dav: 1.39.0
  - federatedfilesharing: 1.24.0
  - files: 2.6.0
  - files_lock: 34.0.0
  - files_sharing: 1.26.0
  - files_trashbin: 1.24.0
  - logreader: 7.0.0
  - lookup_server_connector: 1.22.0
  - oauth2: 1.22.0
  - office: 1.0.0
  - password_policy: 6.0.0-dev.0
  - privacy: 6.0.0-dev.1
  - profile: 1.3.0
  - provisioning_api: 1.24.0
  - related_resources: 5.0.0-dev.0
  - settings: 1.17.0
  - sharebymail: 1.24.0
  - theming: 2.9.0
  - twofactor_backupcodes: 1.23.0
  - viewer: 7.0.0-dev.0
  - webhook_listeners: 1.6.0
  - workflowengine: 2.16.0
Disabled:
  - activity: 7.0.0 (installed 6.0.0-dev.0)
  - admin_audit: 1.24.0
  - app_api: 34.0.0 (installed 33.0.0)
  - circles: 34.0.0 (installed 33.0.0)
  - comments: 1.24.0 (installed 1.23.0)
  - contactsinteraction: 1.15.0 (installed 1.14.1)
  - dashboard: 7.14.0 (installed 7.13.0)
  - encryption: 2.22.0
  - federation: 1.24.0 (installed 1.23.0)
  - files_downloadlimit: 5.2.0-dev.0 (installed 5.1.0-dev.0)
  - files_external: 1.26.0
  - files_pdfviewer: 7.0.0-dev.0 (installed 6.0.0-dev.0)
  - files_reminders: 1.7.0 (installed 1.6.0)
  - files_versions: 1.27.0 (installed 1.26.0)
  - firstrunwizard: 7.0.0-dev.0 (installed 6.0.0-dev.0)
  - nextcloud_announcements: 6.0.0 (installed 5.0.0)
  - notifications: 7.0.0-dev.1 (installed 6.0.0)
  - onlyoffice: 10.0.0 (installed 10.0.0)
  - photos: 7.0.0 (installed 6.0.0-dev.0)
  - recommendations: 7.0.0 (installed 6.0.0-dev.0)
  - richdocuments: 10.1.0 (installed 10.1.0)
  - serverinfo: 6.0.0 (installed 5.0.0-dev.0)
  - support: 6.0.0 (installed 5.0.0)
  - survey_client: 6.0.0-dev.0 (installed 5.0.0-dev.0)
  - suspicious_login: 12.0.0-dev.0
  - systemtags: 1.24.0 (installed 1.23.0)
  - text: 8.0.0 (installed 7.0.0-dev.3)
  - twofactor_nextcloud_notification: 8.0.0
  - twofactor_totp: 16.0.0 (installed 15.0.0-dev.0)
  - updatenotification: 1.24.0 (installed 1.23.0)
  - user_ldap: 1.25.0
  - user_status: 1.14.0 (installed 1.13.0)
  - weather_status: 1.14.0 (installed 1.13.0)
# 
Enabled:
  - appstore: 1.0.0
  - bruteforcesettings: 7.0.0
  - cloud_federation_api: 1.18.0
  - dav: 1.39.0
  - federatedfilesharing: 1.24.0
  - files: 2.6.0
  - files_lock: 34.0.0
  - files_sharing: 1.26.0
  - files_trashbin: 1.24.0
  - logreader: 7.0.0
  - lookup_server_connector: 1.22.0
  - oauth2: 1.22.0
  - office: 1.0.0
  - password_policy: 6.0.0-dev.0
  - privacy: 6.0.0-dev.1
  - profile: 1.3.0
  - provisioning_api: 1.24.0
  - related_resources: 5.0.0-dev.0
  - settings: 1.17.0
  - sharebymail: 1.24.0
  - theming: 2.9.0
  - twofactor_backupcodes: 1.23.0
  - viewer: 7.0.0-dev.0
  - webhook_listeners: 1.6.0
  - workflowengine: 2.16.0
Disabled:
  - activity: 7.0.0 (installed 6.0.0-dev.0)
  - admin_audit: 1.24.0
  - app_api: 34.0.0 (installed 33.0.0)
  - circles: 34.0.0 (installed 33.0.0)
  - comments: 1.24.0 (installed 1.23.0)
  - contactsinteraction: 1.15.0 (installed 1.14.1)
  - dashboard: 7.14.0 (installed 7.13.0)
  - encryption: 2.22.0
  - federation: 1.24.0 (installed 1.23.0)
  - files_downloadlimit: 5.2.0-dev.0 (installed 5.1.0-dev.0)
  - files_external: 1.26.0
  - files_pdfviewer: 7.0.0-dev.0 (installed 6.0.0-dev.0)
  - files_reminders: 1.7.0 (installed 1.6.0)
  - files_versions: 1.27.0 (installed 1.26.0)
  - firstrunwizard: 7.0.0-dev.0 (installed 6.0.0-dev.0)
  - nextcloud_announcements: 6.0.0 (installed 5.0.0)
  - notifications: 7.0.0-dev.1 (installed 6.0.0)
  - onlyoffice: 10.0.0 (installed 10.0.0)
  - photos: 7.0.0 (installed 6.0.0-dev.0)
  - recommendations: 7.0.0 (installed 6.0.0-dev.0)
  - richdocuments: 10.1.0 (installed 10.1.0)
  - serverinfo: 6.0.0 (installed 5.0.0-dev.0)
  - support: 6.0.0 (installed 5.0.0)
  - survey_client: 6.0.0-dev.0 (installed 5.0.0-dev.0)
  - suspicious_login: 12.0.0-dev.0
  - systemtags: 1.24.0 (installed 1.23.0)
  - text: 8.0.0 (installed 7.0.0-dev.3)
  - twofactor_nextcloud_notification: 8.0.0
  - twofactor_totp: 16.0.0 (installed 15.0.0-dev.0)
  - updatenotification: 1.24.0 (installed 1.23.0)
  - user_ldap: 1.25.0
  - user_status: 1.14.0 (installed 1.13.0)
  - weather_status: 1.14.0 (installed 1.13.0)
#
Nextcloud Signing status

Nextcloud Logs

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the delete-and-restore flow through the Web-GUI and Deleted Files, then inspect the files_trashbin handling and the affected oc_filecache row. Compare permissions before deletion and after restoration, including the reported values 24 and 31. Done means the restored file or folder remains accessible and its database permissions are preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.