matrix-org / matrix-org/matrix-spec
Prevent AS routing loops (SPEC-131)
- Dominant language
- HTML
- Stars
- 330
- Forks
- 150
- Avg merge
- 2h 21m
- Merged PRs (30d)
- 3
Description
Problem: Two application services A and B are on IRC channel `#foo`. They both echo messages when a new IRC user joins the room, and when new Matrix users join the room. Alice on IRC joins the room:
```
[ ] indicates the **sender**
IRC Channel Matrix Room
~~--~~~~--~~~~--~~~~--~~~~--~~~~--~~~~--~~~~--~~~~--~~~~--~~~~--~~~~--~~~~--~~~~--~~~~--~~-
[IRC] Alice has joined #foo.
[A] IRC-Alice joined.
[B] IRC_Alice joined.
[B] IRC-Alice has joined #foo.
[A] IRC_Alice has joined #foo
[A] IRC-IRC-Alice joined.
[B] IRC_IRC_Alice joined.
[B] IRC-IRC-Alice has joined #foo.
[A] IRC_IRC_Alice has joined #foo.
[A] IRC-IRC-IRC-Alice joined.
[B] IRC_IRC_IRC_Alice joined.
...
```
We should advise that AS developers mark virtual users as 'bots' and ignore bot traffic to prevent this. However, we need stronger guarantees to prevent this to avoid flooding both the IRC channel and Matrix with events.
One technique would be to put a new state event which is enforced by home servers which determines which HS domains can use application services to monitor this room, e.g. the room pointed to by `#irc_python:matrix.freenode.net` may have a state event saying only application services registered to the HS domain `matrix.freenode.net` should be passed events in this room. This breaks the infinite loop on the Matrix end by preventing `B` from receiving the join events. This relies on home servers implementing these rules, which is deemed more probable than relying on ASes to implement these rules, given we expect there to be many more AS implementations than HS implementations.
Alternative suggestions welcome.
(Imported from https://matrix.org/jira/browse/SPEC-131)
(Reported by @Kegsay)
Contributor guide
Research direction
Start with the problem description and the join-event sequence, then review the proposed application-service and homeserver behavior. The work is done when the project agrees on a concrete, enforceable protocol change that prevents routing loops and records the resulting specification requirements.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100