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:22:03 -0300 |
| commit | 10ba3f78da2e22bd232dc085e2a8a7c293c3fb73 (patch) | |
| tree | 838f2d8168a2271f3e6de5245b2aa93b69114f09 /tests/logging_tests/tests.py | |
| parent | ba24ee34f98cb17d99b1f82bc1ede45ff311a70b (diff) | |
[4.2.x] Refs CVE-2025-48432 -- Made SuspiciousOperation logging use log_response() for consistency.
Backport of ff835f439cb1ecd8d74a24de12e3c03e5477dc9d from main.
Diffstat (limited to 'tests/logging_tests/tests.py')
| -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 03409094f2..bc88749fb7 100644 --- a/tests/logging_tests/tests.py +++ b/tests/logging_tests/tests.py @@ -597,6 +597,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): """ |
