From 3ba7291598b4695702c74d793f6913ffb276ee09 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 10 Nov 2021 12:34:05 +0000 Subject: [PATCH] Ignore invalid room IDs in allow rules --- federationapi/routing/join.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/federationapi/routing/join.go b/federationapi/routing/join.go index 999bf4c1..0af541f8 100644 --- a/federationapi/routing/join.go +++ b/federationapi/routing/join.go @@ -225,7 +225,9 @@ func attemptMakeJoinForRestrictedMembership( for _, allowed := range joinRules.Allow { // Skip types that we don't know about. if allowed.Type != gomatrixserverlib.MRoomMembership { - logger.Infof("Skipping unknown join rule type %q", allowed.Type) + continue + } + if _, _, err := gomatrixserverlib.SplitID('!', allowed.RoomID); err != nil { continue } @@ -240,7 +242,7 @@ func attemptMakeJoinForRestrictedMembership( continue } - logrus.Info("Inspecting room", allowed.RoomID) + logrus.Info("Inspecting room ", allowed.RoomID) // Now have a look and see if any of the joined users match the // user who has initiated this join.