matrix-org / matrix-org/matrix-hookshot

unable to decrypt message on new but verified user session

Open
#974 11 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
450
Forks
95
Avg merge
1d 2h
Merged PRs (30d)
23

Description

Messages sent by the Hookshot bot are consistently unreadable by some users due to decryption issues, displaying only "Unable to decrypt message." It can take up to two days before affected users can successfully decrypt and read the messages.

This issue occurs exclusively with messages from the Hookshot bot.

Is there a way to keep the bot online for an extended period to ensure successful key exchange?

Steps to reproduce:

  • User: Having a active session.
  • Inviting Hookshot Bot and create web hook.
  • Web Hook: sends messages: All Fine
  • User: (delete session or app and/or) creates a new session and verifies this session
  • Web Hook: sends messages: User always get's "unable to decrypt message"

image

Decrypted event:

{
  "type": "m.room.message",
  "content": {
    "msgtype": "m.bad.encrypted",
    "body": "** Unable to decrypt: DecryptionError: The sender's device has not sent us the keys for this message. **"
  }
}

original event:

{
  "type": "m.room.encrypted",
  "sender": "@_webhookhs_prometheus:netresearch.de",
  "content": {
    "algorithm": "m.megolm.v1.aes-sha2",
    "ciphertext": "Awg...OpAY",
    "device_id": "BOPKPMWUPZ",
    "sender_key": "pXN***N0Q",
    "session_id": "iFN***sOQ"
  },
  "origin_server_ts": 1731919570589,
  "unsigned": {
    "membership": "join",
    "age": 62
  },
  "event_id": "$Ht***-a4A",
  "room_id": "!***:netresearch.de"
}

Fix: drop web hook and recreate a new hook. User is able to read messages again ... until he is required to use/create a new session.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Hookshot bot's webhook message path and its Matrix encryption/key-exchange handling, then reproduce the issue by creating a new verified session and receiving a webhook message. Done means messages from an existing webhook decrypt successfully after a user creates or restores a new session, without recreating the webhook.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.