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:54 -0300 |
| commit | 363d2566859a4f6aef4256939b39fd0e2d423157 (patch) | |
| tree | 4ee20a5d2ff513f6e96efa45dff6f4b9fcc60831 /tests | |
| parent | 15e4df1d3379ac69f628d0d2660ce65e7c45dbc2 (diff) | |
[5.1.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 6ce5f2443b..43e912662c 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): """ |
