Skip to content

Conversation

@tcitworld
Copy link
Member

@tcitworld tcitworld commented Jun 14, 2022

Addressbooks and Calendar data are destroyed through hook OC_User::post_deleteUser (legacy stuff), which when it reaches the CardDAV/CalDAV backends sends AddressBookDeletedEvent/CalendarDeletedEvent typed events, which in turns generates activities that aren't deleted until they expire.

This can probably lead to old activities being visible for a new user created with the same uid.

Another way to avoid adding this call to IUserManager::userExists would be to have server make sure the activities table is correctly emptied at the end of OC/User::delete, but there's no event like AfterUserDeletedEvent that would allow the activity app to hook in.

Another possibility is another activity background job that cleans activity entries for users which don't exist anymore, but that's dirty.

@tcitworld tcitworld added bug 3. to review Waiting for reviews feature: dav feature: activity and notification feature: caldav Related to CalDAV internals feature: carddav Related to CardDAV internals labels Jun 14, 2022
@tcitworld tcitworld added this to the Nextcloud 25 milestone Jun 14, 2022
@tcitworld tcitworld requested review from a team and nickvergessen June 14, 2022 09:16
}

foreach ($users as $user) {
if (!$this->userManager->userExists($user)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe prefix with a check for the $action, so we don't run a query per user all the time but only in case of a delete.
But even then I think the impact on normal usage is not worth the benefit on deleting a user?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But even then I think the impact on normal usage is not worth the benefit on deleting a user?

Since we avoid the creation of X activities, it might be.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternate approach would be to add the information that this is a subsequent delete due to a user delete to the Dav events?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would require changing the signatures function for deleteCalendar/deleteAddressbook methods in the backend just for this, which I'm not very comfortable with.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right

@tcitworld tcitworld force-pushed the dav-no-deleted-user-activities branch from 83dec24 to efaac42 Compare June 14, 2022 09:52
…eleted

Addressbooks and Calendar data are destroyed through hook OC_User::pre_deleteUser, which when it reaches the backends sends AddressBookDeletedEvent/CalendarDeletedEvent typed events, which in turns generates activities that aren't deleted until they expire.

This can probably lead to old activities being visible for a new user created with the same uid.

Signed-off-by: Thomas Citharel <[email protected]>
@tcitworld tcitworld force-pushed the dav-no-deleted-user-activities branch from efaac42 to 4129089 Compare June 14, 2022 09:54
Copy link
Member

@CarlSchwan CarlSchwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds fine

@blizzz blizzz requested a review from nickvergessen July 8, 2022 21:09
@miaulalala
Copy link
Contributor

Drone failure unrelated:

latest: Pulling from nextcloud/continuous-integration-alpine-git
--
2 | Digest: sha256:d4aa4eb5c7f6923bd80454a44722f0e35f2916e08f2627210df18652062661b3
3 | Status: Image is up to date for ghcr.io/nextcloud/continuous-integration-alpine-git:latest

@blizzz blizzz merged commit 4ced3a4 into master Jul 22, 2022
@blizzz blizzz deleted the dav-no-deleted-user-activities branch July 22, 2022 22:01
@skjnldsv skjnldsv mentioned this pull request Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug feature: activity and notification feature: caldav Related to CalDAV internals feature: carddav Related to CardDAV internals feature: dav

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants