Skip to content

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

Closed
@ftilde

Description

@ftilde

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.

Metadata

Metadata

Assignees

Labels

Z-ElementX-AlphaRequired for ElementX Alpha (Q2 2022)bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions