From 2af309223d6050feff3f85701a93166f3d4b5fee Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 21 Aug 2023 18:06:29 -0400 Subject: add integration tests --- tests/test_integration.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/test_integration.py') diff --git a/tests/test_integration.py b/tests/test_integration.py index 0b55872d2..184368214 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -220,10 +220,17 @@ class TestEventOnlySubscribers(IntegrationBase, unittest.TestCase): class TestStaticAppUsingAbsPath(StaticAppBase, unittest.TestCase): package = 'tests.pkgs.static_abspath' + def test_nulbyte_chroot(self): + super_w_null = '/static/..\x00/' + res = self.testapp.get(f'/{super_w_null}', status=404) + class TestStaticAppUsingAssetSpec(StaticAppBase, unittest.TestCase): package = 'tests.pkgs.static_assetspec' + def test_nulbyte_chroot(self): + super_w_null = 'static/..\x00/' + res = self.testapp.get(f'/{super_w_null}', status=404) class TestStaticAppWithEncodings(IntegrationBase, unittest.TestCase): package = 'tests.pkgs.static_encodings' -- cgit v1.2.3 From d4a821c7b134b983e72e653b17b5a25507552620 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 21 Aug 2023 18:27:04 -0400 Subject: re-add integration tests (bad merge) and add integration test for nulbyte check when asset spec override exists --- tests/test_integration.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'tests/test_integration.py') diff --git a/tests/test_integration.py b/tests/test_integration.py index 184368214..d14ee846e 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -220,18 +220,30 @@ class TestEventOnlySubscribers(IntegrationBase, unittest.TestCase): class TestStaticAppUsingAbsPath(StaticAppBase, unittest.TestCase): package = 'tests.pkgs.static_abspath' - def test_nulbyte_chroot(self): - super_w_null = '/static/..\x00/' - res = self.testapp.get(f'/{super_w_null}', status=404) - class TestStaticAppUsingAssetSpec(StaticAppBase, unittest.TestCase): package = 'tests.pkgs.static_assetspec' + +class TestStaticAppUsingAbsPathNulByte(IntegrationBase, unittest.TestCase): + package = 'tests.pkgs.static_abspath_nulbyte' + def test_nulbyte_chroot(self): - super_w_null = 'static/..\x00/' + super_w_null = '..\x00/' res = self.testapp.get(f'/{super_w_null}', status=404) +class TestStaticAppUsingAssetSpecNulByte(IntegrationBase, unittest.TestCase): + package = 'tests.pkgs.static_assetspec_nulbyte' + + def test_nulbyte_chroot(self): + super_w_null = '..\x00/' + res = self.testapp.get(f'/{super_w_null}', status=404) + + def test_nulbyte_chroot_assetspec_override(self): + super_w_null = '..\x00/' + res = self.testapp.get(f'/sub/{super_w_null}', status=404) + + class TestStaticAppWithEncodings(IntegrationBase, unittest.TestCase): package = 'tests.pkgs.static_encodings' -- cgit v1.2.3 From bf998f3b0064a9c342f114120d069ec8251e2ff8 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 21 Aug 2023 18:43:33 -0400 Subject: appease linter --- tests/test_integration.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tests/test_integration.py') diff --git a/tests/test_integration.py b/tests/test_integration.py index d14ee846e..63a7088e9 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -230,18 +230,19 @@ class TestStaticAppUsingAbsPathNulByte(IntegrationBase, unittest.TestCase): def test_nulbyte_chroot(self): super_w_null = '..\x00/' - res = self.testapp.get(f'/{super_w_null}', status=404) + self.testapp.get(f'/{super_w_null}', status=404) + class TestStaticAppUsingAssetSpecNulByte(IntegrationBase, unittest.TestCase): package = 'tests.pkgs.static_assetspec_nulbyte' def test_nulbyte_chroot(self): super_w_null = '..\x00/' - res = self.testapp.get(f'/{super_w_null}', status=404) + self.testapp.get(f'/{super_w_null}', status=404) def test_nulbyte_chroot_assetspec_override(self): super_w_null = '..\x00/' - res = self.testapp.get(f'/sub/{super_w_null}', status=404) + self.testapp.get(f'/sub/{super_w_null}', status=404) class TestStaticAppWithEncodings(IntegrationBase, unittest.TestCase): -- cgit v1.2.3