summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2016-07-27 17:54:26 +0100
committerPaul "LeoNerd" Evans <paul@matrix.org>2016-07-27 17:54:26 +0100
commit05f6447301ddc72cec7564f9d39f3e16aaa728c6 (patch)
treef7d675527f490bdb39ec8fca09cbbf9b2cfaf358
parentMerge pull request #957 from matrix-org/markjh/verify (diff)
downloadsynapse-05f6447301ddc72cec7564f9d39f3e16aaa728c6.tar.xz
Forbid non-ASes from registering users whose names begin with '_' (SYN-738)
-rw-r--r--synapse/handlers/register.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py
index b9b5880d64..dd75c4fecf 100644
--- a/synapse/handlers/register.py
+++ b/synapse/handlers/register.py
@@ -53,6 +53,13 @@ class RegistrationHandler(BaseHandler):
                 Codes.INVALID_USERNAME
             )
 
+        if localpart[0] == '_':
+            raise SynapseError(
+                400,
+                "User ID may not begin with _",
+                Codes.INVALID_USERNAME
+            )
+
         user = UserID(localpart, self.hs.hostname)
         user_id = user.to_string()