summaryrefslogtreecommitdiff
path: root/tests/mail/custombackend.py
diff options
context:
space:
mode:
authorNatalia <124304+nessita@users.noreply.github.com>2024-08-19 14:47:38 -0300
committerNatalia <124304+nessita@users.noreply.github.com>2024-09-03 09:33:01 -0300
commit96d84047715ea1715b4bd1594e46122b8a77b9e2 (patch)
tree4958537fcbb3993792a3bcd271fa0b31508166b3 /tests/mail/custombackend.py
parent813de2672bd7361e9a453ab62cd6e52f96b6525b (diff)
[5.0.x] Fixed CVE-2024-45231 -- Avoided server error on password reset when email sending fails.
On successful submission of a password reset request, an email is sent to the accounts known to the system. If sending this email fails (due to email backend misconfiguration, service provider outage, network issues, etc.), an attacker might exploit this by detecting which password reset requests succeed and which ones generate a 500 error response. Thanks to Thibaut Spriet for the report, and to Mariusz Felisiak, Adam Johnson, and Sarah Boyce for the reviews.
Diffstat (limited to 'tests/mail/custombackend.py')
-rw-r--r--tests/mail/custombackend.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/mail/custombackend.py b/tests/mail/custombackend.py
index 14e7f077ba..c63f1c07b5 100644
--- a/tests/mail/custombackend.py
+++ b/tests/mail/custombackend.py
@@ -12,3 +12,9 @@ class EmailBackend(BaseEmailBackend):
# Messages are stored in an instance variable for testing.
self.test_outbox.extend(email_messages)
return len(email_messages)
+
+
+class FailingEmailBackend(BaseEmailBackend):
+
+ def send_messages(self, email_messages):
+ raise ValueError("FailingEmailBackend is doomed to fail.")