Merge branch 'erikj/ratelimit_3pid_invite' of github.com:matrix-org/synapse into matrix-org-hotfixes

This commit is contained in:
Erik Johnston 2019-04-26 18:12:33 +01:00
commit d75fb8ae22
2 changed files with 11 additions and 0 deletions

1
changelog.d/5104.bugfix Normal file
View file

@ -0,0 +1 @@
Fix the ratelimting on third party invites.

View file

@ -33,6 +33,8 @@ from synapse.types import RoomID, UserID
from synapse.util.async_helpers import Linearizer
from synapse.util.distributor import user_joined_room, user_left_room
from ._base import BaseHandler
logger = logging.getLogger(__name__)
id_server_scheme = "https://"
@ -72,6 +74,11 @@ class RoomMemberHandler(object):
self.spam_checker = hs.get_spam_checker()
self._server_notices_mxid = self.config.server_notices_mxid
# This is only used to get at ratelimit function, and
# maybe_kick_guest_users. It's fine there are multiple of these as
# it doesn't store state.
self.base_handler = BaseHandler(hs)
@abc.abstractmethod
def _remote_join(self, requester, remote_room_hosts, room_id, user, content):
"""Try and join a room that this server is not in
@ -722,6 +729,9 @@ class RoomMemberHandler(object):
Codes.FORBIDDEN,
)
# Check whether we'll be ratelimited
yield self.base_handler.ratelimit(requester, update=False)
invitee = yield self._lookup_3pid(
id_server, medium, address
)