matrix-org / matrix-org/mjolnir

Managed Mjolnirs are being informed of every event sent to the appservice

Open
#412 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-Appservice S-Critical T-Task X-Release-Blocker
Dominant language
TypeScript
Stars
445
Forks
75
Avg merge
2d 44m
Merged PRs (30d)
3

Description

The mjolnirs will still compare the event against their joined/protected rooms deeper in the chain, so they won't act on any events in rooms they're not joined to or protecting, but this still is problematic and we should have defence in depth.
https://github.com/matrix-org/mjolnir/blob/818e4cf3153015591b5175d584f542df10e7951b/src/Mjolnir.ts#L533-L558
https://github.com/matrix-org/mjolnir/blob/818e4cf3153015591b5175d584f542df10e7951b/src/ProtectedRoomsSet.ts#L176-L178

Inspiration should be taken from bridges on how they manage tracking of rooms. The thing is you shouldn't do this naively because it does duplicate effort. Mjolnir instance already track which rooms they are joined to and are protecting, we just don't have a way to map from a roomId to a set of Mjolnirs that are joined to that room.

https://github.com/matrix-org/mjolnir/blob/818e4cf3153015591b5175d584f542df10e7951b/src/appservice/MjolnirManager.ts#L99-L104

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 src/Mjolnir.ts lines 533-558 and src/ProtectedRoomsSet.ts lines 176-178 to trace how events are checked against joined and protected rooms. Then read src/appservice/MjolnirManager.ts lines 99-104 and compare room-tracking approaches used by bridges. Done means event notifications are limited to relevant Mjolnir instances without losing existing room protection behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
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.