Prevent following arbitrarily nested symlinks

pull/16/head
Dan Puttick 2017-07-14 17:52:21 -04:00
parent d7280a8535
commit 41abe7e5d6
2 changed files with 7 additions and 1 deletions

View File

@ -737,7 +737,9 @@ class KittenGroomerFileCheck(KittenGroomerBase):
if os.path.isdir(full_path): if os.path.isdir(full_path):
queue.append(full_path) queue.append(full_path)
queue += self.list_files_dirs(full_path) queue += self.list_files_dirs(full_path)
elif os.path.isfile(full_path): elif os.path.isfile(full_path, follow_symlinks=False):
queue.append(full_path)
elif os.path.islink(full_path):
queue.append(full_path) queue.append(full_path)
return queue return queue

View File

@ -90,6 +90,10 @@ def get_filename(sample_file):
return os.path.basename(sample_file.path) return os.path.basename(sample_file.path)
@fixture(scope='module')
def src_dir_path(tmpdir_factory):
return tmpdir_factory.mktemp('src').strpath
@fixture(scope='module') @fixture(scope='module')
def dest_dir_path(tmpdir_factory): def dest_dir_path(tmpdir_factory):
return tmpdir_factory.mktemp('dest').strpath return tmpdir_factory.mktemp('dest').strpath