Skip to content

Expire chats_contacts timestamps after 60 days #6427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
link2xt opened this issue Jan 12, 2025 · 0 comments · Fixed by #6430
Closed

Expire chats_contacts timestamps after 60 days #6427

link2xt opened this issue Jan 12, 2025 · 0 comments · Fixed by #6430
Assignees

Comments

@link2xt
Copy link
Collaborator

link2xt commented Jan 12, 2025

This is a follow-up to #6401. Basic algorithm for group consistency was implemented in #6404 and is merged already.

Drawback of the new algorithm is that for every member that is removed from the group, a chats_contacts row is stored indefinitely with the remove_timestamp set to the time when the member was removed. The list of such members is also sent in Chat-Group-Past-Members header which can be seen as a privacy issue.

The idea to fix this issue is to replace timestamps that are older than 60 days with a timestamp 0 and not include removed members with timestamp 0 to Chat-Group-Past-Members.

Members that have a timestamps older than 60 days can be sent with a timestamp 0. Same for past members, if their timestamp is older than 60 days, it can be treated as 0 and the member should not be included into Chat-Group-Past-Members. This preserves privacy as new members will not learn exact timestamps of member addition and will not learn about past members that were removed long ago. Practically this does not change much for consistency if old timestamps are treated as 0. Old tombstones can be removed during housekeeping. 60 days is an arbitrary threshold but it is known to WhatsApp users which removes past members from the past member list after 60 days: https://faq.whatsapp.com/7179561392143247/

There is a problem with just expiring the timestamps after 60 days #6401 (comment) that should be turned into a test.

Proposed solution is at #6401 (comment)
The idea is to re-introduce member list timestamp and update it every time a message is received that updates member list, even if as a result member list is unchanged. If member list timestamp is older than 60 days, like in the case of importing old backup or the group being inactive for a long time, the chat is considered "stale".
For stale chats Chat-Group-Member-Timestamps is not sent, so only explicit changes can be applied. If a message is received in stale chat, then the whole member list should be taken from the To field (plus the sender in the From field) as if the group is created from scratch.

  1. Alice creates a group with Bob and Charlie.
  2. Alice exports a backup.
  3. Alice removes Charlie, Bob gets a message that Charlie is removed.
  4. Wait 60 days.
  5. Bob adds Fiona to chat. Fiona does not get any info about Charlie as a past member because 60 days have passed.
  6. Alice imports old backup.
  7. Bob sends a message to the chat, without a tombstone for Charlie. Alice learns about Fiona.
  8. Alice sends a message to the chat.
  9. Fiona receives Alice's message (problem: currently it adds Charlie for Fiona; it should not because Alice should not send Chat-Group-Member-Timestamps)
  10. Alice and Fiona receive Bob's message (problem: currently this does not remove Charlie for Alice or Fiona)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant