matrix-org / matrix-org/matrix-bifrost
Duplicated users in Matrix room (and on IRC in combination with Freenode appservice)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 187
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
After setting up bridging in a Matrix room to an XMPP MUC using a newly set up bifrost server, I get all users duplicated. In a room where also the IRC appservice bridge provided by matrix.org is active, I even get users three times (and twice on IRC).
**To Reproduce**
The setup is:
* Homeserver: https://matrix.teckids.org
* XMPP server: mercurius.teckids.org
* MUC domain: conference.mercurius.teckids.org
Configuration, stripepd of commetns and secrets:
```
bridge:
domain: "matrix.teckids.org"
homeserverUrl: "https://matrix.teckids.org"
userPrefix: "_mercurius_"
mediaserverUrl: "https://matrix.teckids.org"
appservicePort: 9555
datastore:
engine: "postgres"
connectionString: "postgres://synapse:xxxxxxxxxx@db-vip.teckids.org/bifrost-xmpp"
purple:
backend: "xmpp-js"
backendOpts:
service: "xmpp://jabber.teckids.org:5348"
domain: "matrix.mercurius.teckids.org"
password: "xxxxxxxx"
portals:
enableGateway: true
aliases:
"^_mercurius_(.+)$":
protocol: "xmpp-js"
properties:
room: "regex:1"
server: "conference.mercurius.teckids.org"
autoRegistration:
enabled: true
protocolSteps:
xmpp-js:
type: "implicit"
parameters:
username: "@matrix.mercurius.teckids.org"
metrics:
enabled: true
provisioning:
enablePlumbing: true
requiredUserPL: 100
logging:
files:
"./info.log": "info"
"./debug.log": "debug"
tuning:
waitOnProfileBeforeSend: true
```
And for registration:
```
id: xxxxxxxxxxxxx
hs_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
as_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
namespaces:
users:
- exclusive: true
regex: '@_mercurius_.*'
aliases:
- exclusive: true
regex: '#_mercurius_.*'
rooms: []
url: 'http://matrix.teckids.org:9555'
sender_localpart: mercurius_bot
rate_limited: true
protocols:
- xmpp
```
I then invited mercurius_bot to the Matrix room, granted it Admin power level and did `!purple bridge xmpp-js conference.mercurius.teckids.org foo`.
**Expected behavior**
I'd expect all Matrix users to join on the XMPP side, and all *native* XMPP users join in Matrix. However, I also see the bridged Matrix users join back into the Matrix room, with MXIDs like `@_mercurius_Tom=20Teichler=2fschul-frei=40conference.mercurius.teckids.org:matrix.teckids.org`. If the Freendoe appservice is also in the room, every user gets added to IRC again as well.
Looking at it now, I suspect broken unquoting of the JID, and resulting mismatch of the bridge user ID.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported bridge configuration and the !purple bridge command, then trace how XMPP JIDs become Matrix user IDs, checking the suspected unquoting mismatch. Done means native XMPP users appear once in Matrix, Matrix users appear once on XMPP, and bridged users are not echoed back or duplicated through IRC.
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