@@ -16,7 +16,7 @@ def download_from_url():
16
16
with open (tarpath , "wb" ) as f :
17
17
f .write (response .raw .read ())
18
18
untarredpath = "/tmp/tmp123"
19
- shutil .unpack_archive (tarpath , untarredpath )
19
+ shutil .unpack_archive (tarpath , untarredpath ) # $result=BAD
20
20
21
21
22
22
# A source catching an S3 filename download
@@ -31,7 +31,7 @@ def download_from_url():
31
31
32
32
s3 = boto3 .client ('s3' )
33
33
s3 .download_file (bucket_name , remote_ziped_name , local_ziped_path )
34
- shutil .unpack_archive (local_ziped_path , base_dir )
34
+ shutil .unpack_archive (local_ziped_path , base_dir ) # $result=BAD
35
35
36
36
37
37
# wget
@@ -45,11 +45,11 @@ def download_from_url():
45
45
46
46
# download(url, out, bar) contains out parameter
47
47
wget .download (url , compressed_file )
48
- shutil .unpack_archive (compressed_file , base_dir )
48
+ shutil .unpack_archive (compressed_file , base_dir ) # $result=BAD
49
49
50
50
# download(url) returns filename
51
51
compressed_file = wget .download (url )
52
- shutil .unpack_archive (compressed_file , base_dir )
52
+ shutil .unpack_archive (compressed_file , base_dir ) # $result=BAD
53
53
54
54
55
55
# A source coming from a CLI argparse module
@@ -63,7 +63,7 @@ def download_from_url():
63
63
64
64
args = parser .parse_args ()
65
65
compressed_file = args .filename
66
- shutil .unpack_archive (compressed_file , base_dir )
66
+ shutil .unpack_archive (compressed_file , base_dir ) # $result=BAD
67
67
68
68
69
69
# A source coming from a CLI and downloaded
@@ -84,7 +84,7 @@ def download_from_url():
84
84
with open (tarpath , "wb" ) as f :
85
85
f .write (response .raw .read ())
86
86
87
- shutil .unpack_archive (tarpath , base_dir )
87
+ shutil .unpack_archive (tarpath , base_dir ) # $result=BAD
88
88
89
89
# the django upload functionality
90
90
# see HttpRequest.FILES: https://docs.djangoproject.com/en/4.1/ref/request-response/#django.http.HttpRequest.FILES
@@ -102,22 +102,22 @@ def simple_upload(request):
102
102
with open (savepath , 'wb+' ) as wfile :
103
103
for chunk in request .FILES ["ufile1" ].chunks ():
104
104
wfile .write (chunk )
105
- shutil .unpack_archive (savepath , base_dir )
105
+ shutil .unpack_archive (savepath , base_dir ) # $result=BAD
106
106
107
107
# Write in binary the uploaded tarball
108
108
myfile = request .FILES .get ("ufile1" )
109
109
file_path = os .path .join (base_dir , "tarball.tar" )
110
110
with file_path .open ('wb' ) as f :
111
111
f .write (myfile .read ())
112
- shutil .unpack_archive (file_path , base_dir )
112
+ shutil .unpack_archive (file_path , base_dir ) # $result=BAD
113
113
114
114
# Save uploaded files using FileSystemStorage Django API
115
115
# see FileSystemStorage: https://docs.djangoproject.com/en/4.1/ref/files/storage/#django.core.files.storage.FileSystemStorage
116
116
for ufile in request .FILES .getlist ():
117
117
fs = FileSystemStorage ()
118
118
filename = fs .save (ufile .name , ufile )
119
119
uploaded_file_path = fs .path (filename )
120
- shutil .unpack_archive (uploaded_file_path , base_dir )
120
+ shutil .unpack_archive (uploaded_file_path , base_dir ) # $result=BAD
121
121
122
122
return render (request , 'simple_upload.html' )
123
123
@@ -139,7 +139,7 @@ def simple_upload(request):
139
139
args = parser .parse_args ()
140
140
unsafe_filename_tar = args .filename
141
141
with tarfile .TarFile (unsafe_filename_tar , mode = "r" ) as tar :
142
- tar .extractall (path = "/tmp/unpack/" , members = tar )
142
+ tar .extractall (path = "/tmp/unpack/" , members = tar ) # $result=BAD
143
143
tar = tarfile .open (unsafe_filename_tar )
144
144
145
145
@@ -164,7 +164,7 @@ def simple_upload(request):
164
164
if member .issym ():
165
165
raise ValueError ("But it is a symlink" )
166
166
result .append (member )
167
- tar .extractall (path = tempfile .mkdtemp (), members = result )
167
+ tar .extractall (path = tempfile .mkdtemp (), members = result ) # $result=BAD
168
168
tar .close ()
169
169
170
170
@@ -173,7 +173,7 @@ def simple_upload(request):
173
173
with open (tarpath , "wb" ) as f :
174
174
f .write (response .raw .read ())
175
175
target_dir = "/tmp/unpack"
176
- tarfile .TarFile (tarpath , mode = "r" ).extractall (path = target_dir )
176
+ tarfile .TarFile (tarpath , mode = "r" ).extractall (path = target_dir ) # $result=BAD
177
177
178
178
179
179
from pathlib import Path
@@ -198,4 +198,4 @@ def default_session() -> boto3.Session:
198
198
target = cache_dir
199
199
else :
200
200
target = Path (tempfile .mkdtemp ())
201
- shutil .unpack_archive (tmp .name , target )
201
+ shutil .unpack_archive (tmp .name , target ) # $result=BAD
0 commit comments