-
Notifications
You must be signed in to change notification settings - Fork 73
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
Add greedy regex for the bridge namespace #366
Conversation
regex: "@.+_.+:.*", | ||
exclusive: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exclusive only prevents humans from registering a name with an underscore in their username, right?
Can other appservices still have an exclusive claim on @slack_
or @telegram_
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't matter in this context, only the bridge is going to see this namespace. Synapse will see the "real" namespace from the reg file.
@@ -639,7 +639,13 @@ export class Bridge { | |||
url: rawReg.url || undefined, | |||
protocols: rawReg.protocols || undefined, | |||
namespaces: { | |||
users: rawReg.namespaces?.users || [], | |||
users: [{ | |||
// Deliberately greedy regex to fix https://github.com/turt2live/matrix-bot-sdk/issues/159 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Too many user namespaces registered: expecting exactly one"
Why is it any array then?
Or is it that you may only have one of any "exclusive" value?
namespaces:
aliases: []
users:
- exclusive: false
regex: "@.*:localhost"
- exclusive: true
regex: "@adminbot:localhost"
This works for me locally.. and I don't see an issue with having two claims.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, this is about the bot-sdk only allowing one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, this is us basically faking it to the bot-sdk that we have one big namespace to get around the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to fix the issue when tested locally. Looks good to me too :)
We don't use the namespace login in the bot-sdk for anything, so this should be safe to do. We don't use this namespace to inform Synapse, so there isn't a risk to security either.
A solution for turt2live/matrix-bot-sdk#159
Hopefully helps solve matrix-org/matrix-appservice-irc#1490