element-hq / element-hq/synapse

No entry in device_lists left when user rejects invite

Open
#6,163 0 comments 0 reactions 0 assignees View on GitHub
A-Device-List-Tracking O-Uncommon S-Tolerable T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#6163](https://github.com/matrix-org/synapse/issues/6163).

---

In https://github.com/matrix-org/synapse/blob/master/synapse/handlers/sync.py#L1392 we only include a member in `newly_left_users` if their previous membership was `join`, but in the other branch of the `if`, we include them in `newly_joined_or_invited_users` if they're, well, joined or invited, so if a user goes from `invite` to `leave` (or `ban`) then we'll never send them in the `left` section.

NB. clients shouldn't be relying on this to work out who to encrypt to (and indeed the js-sdk does not) so this doesn't cause events to be encrypted to anyone they shouldn't be. It might just cause clients to continue tracking the device lists of some users when they don't need to.

Contributor guide

Open the contributing guide

Research direction

Start in synapse/handlers/sync.py around line 1392 and trace how membership transitions populate newly_left_users and newly_joined_or_invited_users. Reproduce the invite-to-leave and invite-to-ban cases, then verify that the affected users appear in the left section so clients can stop tracking their device lists.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.