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

MSC2923: Connect Matrix room to another Matrix room #2923

Draft
wants to merge 4 commits into
base: old_master
Choose a base branch
from

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Dec 22, 2020

Connect Matrix room to another Matrix room to effectively create a native Matrix to Matrix bridge.

Rendered


Todo

  • Needs more technical discussion around actual ideas to accomplish
  • Needs MSC number assigned

@MadLittleMods MadLittleMods added proposal A matrix spec change proposal kind:feature MSC for not-core and not-maintenance stuff labels Dec 22, 2020
@@ -0,0 +1,62 @@
# MSC0000: Matrix to Matrix connections
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be well up for figuring out a way (like this) to figure out how to replace plumbed bridged rooms with a generic "reversibly link this room to another matrix room" mechanism.

Currrently all bridges which support plumbing have to implement it separately, and hook up their own admin APIs for managing it, whereas in the end, the problem of saying "i have a community in #foo:matrix.org and a community in #foo_bar:gitter.im - please can i just sync their content, assuming the admins of both rooms are happy to do so" feels like it's a generic useful mechanism.

I haven't dug through the proposal in this MSC yet tho'.

(@MadLittleMods: MSC numbers aren't allocated, other than via GH - this one is 2923)

@Half-Shot Half-Shot self-requested a review December 22, 2020 23:46
@turt2live turt2live changed the title MSC0000: Connect Matrix room to another Matrix room MSC2923: Connect Matrix room to another Matrix room Dec 23, 2020
@@ -0,0 +1,62 @@
# MSC2923: Matrix to Matrix connections
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may go some way to solving decentralised bridges too. If each bridge maintains its own portal room, it can then be up to the bridges to negotiate on who bridges who.


## Proposal

Add a mechanism to homeservers to be able connect and ferry messages back and forth from another Matrix room.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm going to put out thoughts here in different threads).

I'd like to avoid mixing messages between rooms at the DAG level, and this connection be a layer on top supported by the homeserver. Rooms would continue to be separate at that level, but the client would still see a room with messages mixed in from both rooms.

This however presents a problem in that it's difficult to splice together two different rooms as the DAG is used for ordering. You'd need some way to interject messages in a way that works. And then you can have things like replies/relationships which would be cross room, and would cause all sorts of headaches.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This however presents a problem in that it's difficult to splice together two different rooms as the DAG is used for ordering. You'd need some way to interject messages in a way that works

Relates to #2716 and incrementally importing existing message history but we haven't come up with anything concrete there yet.

Copy link
Contributor Author

@MadLittleMods MadLittleMods Dec 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When someone sends a message to a room, we can also put a pointer reference event to the message in the connected room. This way we can follow the pointer to the single source of truth which may have edits, etc. This also makes it ordered in the DAG as expected for both rooms.

Copy link
Contributor Author

@MadLittleMods MadLittleMods Dec 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added your potential solution (@Half-Shot) and the one I just mentioned to the MSC 👍

  • Message pointer reference events
  • Connection layer on top of the DAG

## Proposal

Add a mechanism to homeservers to be able connect and ferry messages back and forth from another Matrix room.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Alice joins room A, they would not see history until they join room B too? Would we need some kind of auto-join / auto-invite > join mechanism to avoid split brain views of the room?

Copy link
Contributor Author

@MadLittleMods MadLittleMods Dec 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Federated peeking 🤷

Re: #2923 (comment), if there are pointer reference events in the connected room, we can show a placeholder that you need to join the other room to see the message

## Proposal

Add a mechanism to homeservers to be able connect and ferry messages back and forth from another Matrix room.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would power levels work in this instance? Presumably if a bridge has admin in it's portal room, it would not automatically get authority in the other room. This presents a problem in so far that if a IRC OP kicks/bans a Matrix user from the chat, how would the bridge handle that?

Would users be expected to op the bridge in the plumbed room, which would feel somewhat awkward and unexpected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone gets banned in a Matrix room, messages coming from the connected Matrix room would also be blocked. But I don't think the ban would necessarily carry through to the connected room by default.

Maybe we could add an option to "ban in connected rooms" as well which would only work if you were also authorized there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This relates to the PL(power-level/permission) syncing across rooms in a space from MSC1772 (see "room admin bot"), https://github.com/matrix-org/matrix-doc/pull/1772/files. We could probably re-use the same mechanism for syncing bans.

Or maybe MSC2313: Moderation policies as rooms (ban lists)

## Security considerations

People might not realize their message is being shared more broadly to another audience. Also relating to a private room being connected to a public room.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd need a two way negotiation system for this kind of linking, or the guys at #badroom:evilcorp.com could easily bind themselves to #matrix:matrix.org and cause hell.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to security consideration section 👍


This solution is flexible to solve any scenario but this functionality could also be built into the homeserver.

This also requires more burden on people having to host their own bridge.
Copy link
Contributor Author

@MadLittleMods MadLittleMods Jan 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted by @Half-Shot: Maintaining senders will be a problem if it's an AS bridge


This solution is flexible to solve any scenario but this functionality could also be built into the homeserver.

This also requires more burden on people having to host their own bridge.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also how does setting up the link/connection between rooms work for someone who doesn't own the homeserver

@MurzNN
Copy link
Contributor

MurzNN commented Jan 17, 2021

Also as alternative may be merging two separate rooms to one using Room Upgrades mechanism?

@MurzNN
Copy link
Contributor

MurzNN commented Jan 17, 2021

And will be good to add "Rendered" link in MSC description to full description, like in most other MSC.

@MurzNN
Copy link
Contributor

MurzNN commented Jan 17, 2021

Also as alternative may be merging two separate rooms to one using Room Upgrades mechanism?

Ow, this already proposed in:

This requires a lot of manual poking on the bridges side to get setup and additional work if rooms are already created on each side like adding m.room.tombstone to point people to the new correct place.

But not yet available for users in Matrix clients. Will be good to have some command to merge two rooms into one, using m.room.tombstone event, manually in Matrix client interface, at least. This will can already solve some problems with bridged rooms, for example when bridge moves from one server to another, like this: mautrix/telegram#394


#### Message pointer reference events

When someone sends a message to a room, we also send a pointer reference event to the connected room which marks that messages place in the DAG.
Copy link
Contributor Author

@MadLittleMods MadLittleMods Oct 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe forwarded events, MSC2723 or MSC2730

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants