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

Allow appservice user namespace to contain non .*|.+ suffixes #151

Merged
merged 8 commits into from
Sep 1, 2021

Conversation

Half-Shot
Copy link
Contributor

@Half-Shot Half-Shot commented Aug 19, 2021

This should not be a breaking change, as we add a new option to the Appservice class enableUserSuffixCheck.

Following conversation with @turt2live & @MadLittleMods, we're instead just going to throw in the functions

The rationale behind this change is that existing bridges (particularly those of the matrix-appservice-bridge class) have quite a range of namespace formats. The Gitter bridges uses a very simple number regex, for instance. I'd like to propose that developers should be able to disable the userPrefix check and instead opt out of functions which would require them to have a valid prefix.

@turt2live turt2live self-requested a review August 31, 2021 15:37
return userId === this.botUserId || (userId.startsWith(this.userPrefix) && userId.endsWith(":" + this.options.homeserverName));
return userId === this.botUserId ||
!!this.registration.namespaces?.users.find(({regex}) =>
new RegExp(regex).test(userId)
Copy link
Owner

Choose a reason for hiding this comment

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

This should probably be cached, but is fine for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants