diff options
| author | Natalia <124304+nessita@users.noreply.github.com> | 2025-06-05 10:07:17 -0300 |
|---|---|---|
| committer | Natalia <124304+nessita@users.noreply.github.com> | 2025-06-06 09:07:06 -0300 |
| commit | 9d7fc9eb1c79242f3330aa62629699a8b5fc5451 (patch) | |
| tree | 141bc9147ab0cd14a1851b7f5baaf741db540ecd /tests | |
| parent | c042af7147490e3ae07d219cf10f3d6d1b16cad3 (diff) | |
[5.2.x] Refs CVE-2025-48432 -- Made SuspiciousOperation logging use log_response() for consistency.
Backport of ff835f439cb1ecd8d74a24de12e3c03e5477dc9d from main.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/logging_tests/tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py index a3ea1550cd..520ce6d268 100644 --- a/tests/logging_tests/tests.py +++ b/tests/logging_tests/tests.py @@ -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): """ |
