summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Maat <tristan.maat@codethink.co.uk>2019-12-09 17:38:34 +0000
committerTristan Maat <tristan.maat@codethink.co.uk>2019-12-09 17:38:34 +0000
commit02f9939163b54b61110e99fec89fa03dad591a17 (patch)
tree02ab305c268a650367d624e2d1fede2ec19a4e0c
parent142ada1c7ad891c2fceadd525debc7075bf0fd03 (diff)
downloadbuildstream-tlater/tar-test-security.tar.gz
tests/sources/tar.py: chown+chmod instead of giving 777 permissionstlater/tar-test-security
While this is deep in our test suite, and should therefore never create files that leak information, our code security linter complains. So instead we perform a slightly safer chown + chmod to ensure we have write permissions, because there is no practical reason not to and it makes for nicer code to copy + paste.
-rw-r--r--tests/sources/tar.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/sources/tar.py b/tests/sources/tar.py
index f5f3dde2d..acf0a99a5 100644
--- a/tests/sources/tar.py
+++ b/tests/sources/tar.py
@@ -306,7 +306,8 @@ def test_read_only_dir(cli, tmpdir, datafiles, tar_name, base_dir):
# Make tmpdir deletable no matter what happens
def make_dir_writable(_fn, path, _excinfo):
- os.chmod(os.path.dirname(path), 0o777)
+ os.chown(os.path.dirname(path), os.geteuid())
+ os.chmod(os.path.dirname(path), 0o700)
if os.path.isdir(path):
os.rmdir(path)
else: