nextcloud / nextcloud/server

[Bug]: After removing a user with occ, some of its related data remains in a few DB tables

Open
#38,680 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

⚠️ This issue respects the following points: ⚠️
  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.
Bug description

Hello,

Using Nextcloud 26.0.2 (Yunohost package, but it seems not to be limited to that very package), when deleting a user using occ, I notice that if most of that user data is deleted as expected, some do remains (neither particularly heavy nor sensitve data, but still...) in the following tables

  • oc_addressbookchanges
  • oc_jobs - this table seems related to logging, probably it is fine not to remove the deleted user's data from there?
  • oc_storages
  • oc_mail_tags - reported at Nextcloud Mail app's forum
  • oc_notifications_settings
Steps to reproduce
  1. Create a user testuser
  2. Associate an email account to it in Nextcloud Mail app (that may be an optional step)
  3. Delete the user using occ user:delete testuser
  4. Check mentioned MySQL table to see whether data related to testuser still remain in there.
Expected behavior

I guess all data related to the deleted user should be removed (or at least that there an option is provided to do so)

Installation method

None

Nextcloud Server version

26

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Nginx

Database engine version

MariaDB

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
{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "mydomain.tld"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "25.0.6.1",
        "overwrite.cli.url": "https:\/\/mydomain.tld",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "updatechecker": false,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "integrity.check.disabled": true,
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": "5555",
            "timeout": "0.0",
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "hashing_default_password": true,
        "localstorage.allowsymlinks": true,
        "simpleSignUpLink.shown": false,
        "logout_url": "https:\/\/mydomain.tld\/yunohost\/sso\/?action=logout",
        "maintenance": false,
        "loglevel": 2
    }
}
List of activated Apps
Enabled:
  - calendar: 4.3.4
  - circles: 25.0.0
  - cloud_federation_api: 1.8.0
  - comments: 1.15.0
  - contactsinteraction: 1.6.0
  - dashboard: 7.5.0
  - dav: 1.24.0
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_external: 1.17.0
  - files_mindmap: 0.0.28
  - files_pdfviewer: 2.6.0
  - files_rightclick: 1.4.0
  - files_sharing: 1.17.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - firstrunwizard: 2.14.0
  - forms: 3.3.0
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - mail: 2.2.6
  - nextcloud_announcements: 1.14.0
  - notifications: 2.13.1
  - oauth2: 1.13.0
  - password_policy: 1.15.0
  - photos: 2.0.1
  - polls: 5.0.5
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - ransomware_protection: 1.14.0
  - recommendations: 1.4.0
  - related_resources: 1.0.4
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - spreed: 15.0.6
  - support: 1.8.0
  - survey_client: 1.13.0
  - systemtags: 1.15.0
  - tasks: 0.15.0
  - text: 3.6.0
  - theming: 2.0.1
  - twofactor_backupcodes: 1.14.0
  - user_ldap: 1.15.0
  - user_status: 1.5.0
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - workflowengine: 2.7.0
Disabled:
  - accessibility
  - activity: 2.15.0
  - admin_audit
  - bruteforcesettings
  - deck: 1.8.5
  - encryption
  - files_videoplayer
  - groupfolders: 13.1.3
  - integration_whiteboard: 0.0.14
  - richdocuments: 7.1.4
  - shifts: 1.8.6
  - suspicious_login
  - talked: 0.5.0
  - twofactor_totp
  - updatenotification: 1.12.0
Nextcloud Signing status

No response

Nextcloud Logs

No response

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

Start with the occ user:delete testuser entry point and trace the user-removal path for the listed tables: oc_addressbookchanges, oc_jobs, oc_storages, and oc_mail_tags. Reproduce the deletion with a test user, determine which remaining rows are expected, and verify that the agreed cleanup behavior is consistent across the tables.

Written by the indexing model from the issue text.

Assessment

Tech stack
mariadb, php
Domain
backend, cli, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.