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

pastly at torproject.org pastly at torproject.org
Thu Aug 9 14:21:19 UTC 2018


commit c78c93b3576b877a1b181c5374db757c34da0f44
Author: Matt Traudt <sirmatt at ksu.edu>
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:





More information about the tor-commits mailing list