mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +00:00
Fix appservice username check (#2223)
* Fix appservice username check * Flakey test moved to blocklist * Move tests to blacklist
This commit is contained in:
parent
626d3f6cf5
commit
05fa66c9c8
3 changed files with 13 additions and 4 deletions
|
@ -139,11 +139,17 @@ func SetLocalAlias(
|
|||
// TODO: This code should eventually be refactored with:
|
||||
// 1. The new method for checking for things matching an AS's namespace
|
||||
// 2. Using an overall Regex object for all AS's just like we did for usernames
|
||||
|
||||
reqUserID, _, err := gomatrixserverlib.SplitID('@', device.UserID)
|
||||
if err != nil {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.BadJSON("User ID must be in the form '@localpart:domain'"),
|
||||
}
|
||||
}
|
||||
for _, appservice := range cfg.Derived.ApplicationServices {
|
||||
// Don't prevent AS from creating aliases in its own namespace
|
||||
// Note that Dendrite uses SenderLocalpart as UserID for AS users
|
||||
if device.UserID != appservice.SenderLocalpart {
|
||||
if reqUserID != appservice.SenderLocalpart {
|
||||
if aliasNamespaces, ok := appservice.NamespaceMap["aliases"]; ok {
|
||||
for _, namespace := range aliasNamespaces {
|
||||
if namespace.Exclusive && namespace.RegexpObject.MatchString(alias) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue