[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [sbws/master] Require files be in the given directory



commit c78c93b3576b877a1b181c5374db757c34da0f44
Author: Matt Traudt <sirmatt@xxxxxxx>
Date:   Wed Aug 1 19:25:25 2018 -0400

    Require files be in the given directory
---
 sbws/core/cleanup.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sbws/core/cleanup.py b/sbws/core/cleanup.py
index a3e8cc6..ad5b286 100644
--- a/sbws/core/cleanup.py
+++ b/sbws/core/cleanup.py
@@ -103,6 +103,7 @@ def _delete_files(dname, files, dry_run=True):
     with DirectoryLock(dname):
         for fname in files:
             log.info('Deleting %s', fname)
+            assert os.path.commonprefix([dname, fname]) == dname
             if not dry_run:
                 os.remove(fname)
 
@@ -128,6 +129,7 @@ def _compress_files(dname, files, dry_run=True):
     with DirectoryLock(dname):
         for fname in files:
             log.info('Compressing %s', fname)
+            assert os.path.commonprefix([dname, fname]) == dname
             if dry_run:
                 continue
             with open(fname, 'rt') as in_fd:



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits