1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Refs CVE-2025-48432 -- Made SuspiciousOperation logging use log_response() for consistency.

This commit is contained in:
Natalia
2025-06-05 10:07:17 -03:00
committed by nessita
parent 9d72e7daf7
commit ff835f439c
2 changed files with 20 additions and 10 deletions

View File

@@ -618,6 +618,15 @@ class SecurityLoggerTest(LoggingAssertionMixin, SimpleTestCase):
self.assertEqual(len(mail.outbox), 1)
self.assertIn("SuspiciousOperation at /suspicious/", mail.outbox[0].body)
def test_response_logged(self):
with self.assertLogs("django.security.SuspiciousOperation", "ERROR") as handler:
response = self.client.get("/suspicious/")
self.assertLogRecord(
handler, "dubious", logging.ERROR, 400, request=response.wsgi_request
)
self.assertEqual(response.status_code, 400)
class SettingsCustomLoggingTest(AdminScriptTestCase):
"""