mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 16:16:04 -04:00
Disable /register/available if registration is disabled (#6082)
Fixes #6066 This register endpoint should be disabled if registration is disabled, otherwise we're giving anyone the ability to check if a username exists on a server when we don't need to be. Error code is 403 (Forbidden) as that's the same returned by /register when registration is disabled.
This commit is contained in:
parent
1c9feadf4b
commit
1b519e0272
2 changed files with 6 additions and 0 deletions
|
@ -328,6 +328,11 @@ class UsernameAvailabilityRestServlet(RestServlet):
|
|||
|
||||
@defer.inlineCallbacks
|
||||
def on_GET(self, request):
|
||||
if not self.hs.config.enable_registration:
|
||||
raise SynapseError(
|
||||
403, "Registration has been disabled", errcode=Codes.FORBIDDEN
|
||||
)
|
||||
|
||||
ip = self.hs.get_ip_from_request(request)
|
||||
with self.ratelimiter.ratelimit(ip) as wait_deferred:
|
||||
yield wait_deferred
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue