diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py index b9b5880d6403a9a56109576d10d99bfe8ae86b4b..dd75c4fecf70806adaf22c6e71d9dc99a07759a5 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()