mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:46:01 -04:00
Limit length of accepted email addresses (#9855)
This commit is contained in:
parent
69018acbd2
commit
177dae2704
6 changed files with 100 additions and 7 deletions
|
@ -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.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue