Skip to content

Commit 3d14c5f

Browse files
authored
Python: Update tests
We need to import `tty` in order to be able to detect the standard library correctly.
1 parent ab81247 commit 3d14c5f

File tree

1 file changed

+3
-2
lines changed
  • python/ql/test/experimental/query-tests/Security/CWE-022

1 file changed

+3
-2
lines changed

python/ql/test/experimental/query-tests/Security/CWE-022/zipslip_bad.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import tarfile
22
import shutil
3-
import bz2
3+
import bz2
44
import gzip
55
import zipfile
66

@@ -23,7 +23,7 @@ def unzip2(filename):
2323
shutil.copyfile(entry, "/tmp/unpack/")
2424

2525
def unzip3(filename):
26-
zf = zipfile.ZipFile(filename)
26+
zf = zipfile.ZipFile(filename)
2727
with zf.namelist() as filelist:
2828
#BAD : This could write any file on the filesystem.
2929
for x in filelist:
@@ -36,3 +36,4 @@ def unzip4(filename):
3636
with zf.open(x) as srcf:
3737
shutil.copyfileobj(x, "/tmp/unpack/")
3838

39+
import tty # to set the import root so we can identify the standard library

0 commit comments

Comments
 (0)