Skip to content
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

matrix-sdk: Ensure correct room for events loaded by chunks #8168

Merged
merged 1 commit into from
Mar 2, 2023

Conversation

SpiritCroc
Copy link
Contributor

Chunks should not load events from other rooms if they happen to be requested for one eventId that already exists in a different room.

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Always check for correct roomId when loading events from chunks.

Motivation and context

Motivation from a client that renders rich replies (although the broken scenario can most likely appear in other cases as well, may be less severe):

If somebody links an invalid eventId in a room, which however is valid in a different room, this can mess up our timelines badly. This can be reproduced by replying to an event in a room, then forward the reply to a different room with a client that also forwards the replied-to information (such as FluffyChat - likely a bug though). Then click on the rich reply to open the eventId. Previously, Android could find the event from the other room and thus replace the correct timeline with the wrong one.
Together with the feature to always open the timeline at the last read event, this can persistently replace the timeline of one room with the wrong one.

Compare e.g. https://matrix.to/#/!bfebJVBOZMnORmkVdO:matrix.org/$wUyRiMQEjaWOpJ-XpdBJzuXkh95N7bce2pVT4IMXW50?via=schildi.chat&via=matrix.org&via=envs.net linking to an event that exists here
https://matrix.to/#/!SDwMepdfgrmExhyxYZ:schildi.chat/$MO2G4MZZ1zg0Ymc9gTfekIyw7QFkNn4OvYQKK1PAGlE

Tests

See motivation.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

Sign-off

Signed-off-by: Tobias Büttner [email protected]

Chunks should not load events from other rooms if they happen to be
requested for one eventId that already exists in a different room.

Motivation from a client that renders rich replies (although the
broken scenario can appear in other cases as well):

If somebody links an invalid eventId in a room, which however is valid
in a different room, this can mess up our timelines badly.
This can be reproduced by replying to an event in a room, then forward
the reply to a different room with a client that also forwards the
replied-to information (such as FluffyChat). Then click on the rich
reply to open the eventId. Previously, Android could find the event from
the other room and thus replace the correct timeline with the wrong one.

Compare e.g. https://matrix.to/#/!bfebJVBOZMnORmkVdO:matrix.org/$wUyRiMQEjaWOpJ-XpdBJzuXkh95N7bce2pVT4IMXW50?via=schildi.chat&via=matrix.org&via=envs.net
linking to an event that exists here
https://matrix.to/#/!SDwMepdfgrmExhyxYZ:schildi.chat/$MO2G4MZZ1zg0Ymc9gTfekIyw7QFkNn4OvYQKK1PAGlE

Change-Id: I4dcee94353d954fb6ed57c3970686a620b831c6f
@bmarty bmarty added the Z-Community-PR Issue is solved by a community member's PR label Mar 2, 2023
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@bmarty bmarty merged commit c7928c2 into element-hq:develop Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-Community-PR Issue is solved by a community member's PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants