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

Reactions sent via Joined::send in encrypted rooms are encrypted, but shouldn't be #470

Closed
ftilde opened this issue Jan 16, 2022 · 1 comment · Fixed by #606
Closed

Reactions sent via Joined::send in encrypted rooms are encrypted, but shouldn't be #470

ftilde opened this issue Jan 16, 2022 · 1 comment · Fixed by #606
Assignees
Labels
bug Something isn't working Z-ElementX-Alpha Required for ElementX Alpha (Q2 2022)
Milestone

Comments

@ftilde
Copy link
Contributor

ftilde commented Jan 16, 2022

Describe the bug
According to some discussion in the ruma matrix channel, reaction events should not be encrypted, but are apparently. Since the "m.relates_to"-part is also sent unencrypted, the message content is also duplicated effectively.

To Reproduce

  1. Create a ReactionEventContent
  2. Send it via Joined::send

Expected behavior
The message sent should look something like this:

{
  "room_id": "...",
  "event_type": "m.reaction",
  "txn_id": "...",
  "body": {
    "m.relates_to": {
      "rel_type": "m.annotation",
      "event_id": "...",
      "key": "someemoji"
    }
  }
}

Actual behavior
The message looks like this:

{
  "room_id": "...",
  "event_type": "m.room.encrypted",
  "txn_id": "...",
  "body": {
    "algorithm": "m.megolm.v1.aes-sha2",
    "ciphertext": "...",
    "sender_key": "...",
    "device_id": "...",
    "session_id": "...",
    "m.relates_to": {
      "rel_type": "m.annotation",
      "event_id": "...",
      "key": "someemoji"
    }
  }
}

Additional context
The reason that I stumbled upon this and what makes this especially annoying is that apparently synapse recognizes these messages as reactions, and sends them bundled with the message that was reacted to, but incorrectly (?) assigns the type "m.room.encrypted" for the annotations which causes ruma to fail to decrypt the message as a result.

@zecakeh
Copy link
Collaborator

zecakeh commented Apr 2, 2022

Another issue with encrypting reactions: since the m.relates_to is removed during redaction, it's not possible to know if a redacted encrypted event was a reaction or not, which makes clients show them as redacted messages.

This would be fixed by MSC3389, but would need a new room version.

@jplatte jplatte changed the title Reactions send via Joined::send in encrypted rooms are encrypted, but shouldn't be Reactions sent via Joined::send in encrypted rooms are encrypted, but shouldn't be Apr 8, 2022
@jplatte jplatte added the bug Something isn't working label Apr 8, 2022
@gnunicorn gnunicorn added the Z-ElementX-Alpha Required for ElementX Alpha (Q2 2022) label Apr 21, 2022
@poljar poljar added this to the v0.5.0 milestone Apr 25, 2022
@poljar poljar self-assigned this Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Z-ElementX-Alpha Required for ElementX Alpha (Q2 2022)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants