diff options
| author | Florian Apolloner <florian@apolloner.eu> | 2021-05-17 11:26:36 +0200 |
|---|---|---|
| committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2021-06-02 10:44:39 +0200 |
| commit | dfaba12cda060b8b292ae1d271b44bf810b1c5b9 (patch) | |
| tree | fb95208300cbdb20b3e62ac0b4b26563e551a3ea /tests | |
| parent | aed140955809bc850e3b73628800727a5eaf1a33 (diff) | |
[3.2.x] Fixed CVE-2021-33203 -- Fixed potential path-traversal via admindocs' TemplateDetailView.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/admin_docs/test_views.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/admin_docs/test_views.py b/tests/admin_docs/test_views.py index 47bec73a50..45fc50012b 100644 --- a/tests/admin_docs/test_views.py +++ b/tests/admin_docs/test_views.py @@ -137,6 +137,22 @@ class AdminDocViewTests(TestDataMixin, AdminDocsTestCase): self.assertContains(response, 'View documentation') +@unittest.skipUnless(utils.docutils_is_available, 'no docutils installed.') +class AdminDocViewDefaultEngineOnly(TestDataMixin, AdminDocsTestCase): + + def setUp(self): + self.client.force_login(self.superuser) + + def test_template_detail_path_traversal(self): + cases = ['/etc/passwd', '../passwd'] + for fpath in cases: + with self.subTest(path=fpath): + response = self.client.get( + reverse('django-admindocs-templates', args=[fpath]), + ) + self.assertEqual(response.status_code, 400) + + @override_settings(TEMPLATES=[{ 'NAME': 'ONE', 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
