Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Ensure email validation link parameters are URL-encoded #6063

Merged
merged 2 commits into from
Sep 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/6063.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure query parameters in email validation links are URL-encoded.
10 changes: 6 additions & 4 deletions synapse/push/mailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,11 @@ def send_password_reset_mail(self, email_address, token, client_secret, sid):
group together multiple email sending attempts
sid (str): The generated session ID
"""
params = {"token": token, "client_secret": client_secret, "sid": sid}
link = (
self.hs.config.public_baseurl
+ "_matrix/client/unstable/password_reset/email/submit_token"
"?token=%s&client_secret=%s&sid=%s" % (token, client_secret, sid)
+ "_matrix/client/unstable/password_reset/email/submit_token?%s"
% urllib.parse.urlencode(params)
)

template_vars = {"link": link}
Expand All @@ -163,10 +164,11 @@ def send_registration_mail(self, email_address, token, client_secret, sid):
group together multiple email sending attempts
sid (str): The generated session ID
"""
params = {"token": token, "client_secret": client_secret, "sid": sid}
link = (
self.hs.config.public_baseurl
+ "_matrix/client/unstable/registration/email/submit_token"
"?token=%s&client_secret=%s&sid=%s" % (token, client_secret, sid)
+ "_matrix/client/unstable/registration/email/submit_token?%s"
% urllib.parse.urlencode(params)
)

template_vars = {"link": link}
Expand Down