summaryrefslogtreecommitdiff
path: root/tests/file_storage
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.es>2021-05-04 14:44:19 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-05-06 07:42:21 +0200
commita937d7f2142eb6f987679efc82f2c74f47d17ce1 (patch)
tree0242f0a01ec0e13488ede699aa8192b6d030408e /tests/file_storage
parent364098fdac597d2293d844d81ab523c22ca5a361 (diff)
[3.2.x] Refs CVE-2021-31542 -- Skipped mock AWS storage test on Windows.
The validate_file_name() sanitation introduced in 0b79eb36915d178aef5c6a7bbce71b1e76d376d3 correctly rejects the example file name as containing path elements on Windows. This breaks the test introduced in 914c72be2abb1c6dd860cb9279beaa66409ae1b2 to allow path components for storages that may allow them. Test is skipped pending a discussed storage refactoring to support this use-case. Backport of a708f39ce67af174df90c5b5e50ad1976cec7cb8 from main
Diffstat (limited to 'tests/file_storage')
-rw-r--r--tests/file_storage/test_generate_filename.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/file_storage/test_generate_filename.py b/tests/file_storage/test_generate_filename.py
index 9f54f6921e..4746a53f69 100644
--- a/tests/file_storage/test_generate_filename.py
+++ b/tests/file_storage/test_generate_filename.py
@@ -1,4 +1,6 @@
import os
+import sys
+from unittest import skipIf
from django.core.exceptions import SuspiciousFileOperation
from django.core.files.base import ContentFile
@@ -93,6 +95,7 @@ class GenerateFilenameStorageTests(SimpleTestCase):
os.path.normpath('some/folder/test_with_space.txt')
)
+ @skipIf(sys.platform == 'win32', 'Path components in filename are not supported after 0b79eb3.')
def test_filefield_awss3_storage(self):
"""
Simulate a FileField with an S3 storage which uses keys rather than