summary refs log tree commit diff
path: root/synapse/push
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-04-22 17:49:11 +0100
committerGitHub <noreply@github.com>2021-04-22 17:49:11 +0100
commit177dae270420ee4b4c8fa5e2c74c5081d98da320 (patch)
tree8c46c0b63e869f8b1db5a67ce3eb6ea22a26292f /synapse/push
parentClear the resync bit after resyncing device lists (#9867) (diff)
downloadsynapse-177dae270420ee4b4c8fa5e2c74c5081d98da320.tar.xz
Limit length of accepted email addresses (#9855)
Diffstat (limited to 'synapse/push')
-rw-r--r--synapse/push/emailpusher.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/push/emailpusher.py b/synapse/push/emailpusher.py
index cd89b54305..99a18874d1 100644
--- a/synapse/push/emailpusher.py
+++ b/synapse/push/emailpusher.py
@@ -19,8 +19,9 @@ from twisted.internet.error import AlreadyCalled, AlreadyCancelled
 from twisted.internet.interfaces import IDelayedCall
 
 from synapse.metrics.background_process_metrics import run_as_background_process
-from synapse.push import Pusher, PusherConfig, ThrottleParams
+from synapse.push import Pusher, PusherConfig, PusherConfigException, ThrottleParams
 from synapse.push.mailer import Mailer
+from synapse.util.threepids import validate_email
 
 if TYPE_CHECKING:
     from synapse.server import HomeServer
@@ -71,6 +72,12 @@ class EmailPusher(Pusher):
 
         self._is_processing = False
 
+        # Make sure that the email is valid.
+        try:
+            validate_email(self.email)
+        except ValueError:
+            raise PusherConfigException("Invalid email")
+
     def on_started(self, should_check_for_notifs: bool) -> None:
         """Called when this pusher has been started.