Skip to content

Commit

Permalink
Version 2.
Browse files Browse the repository at this point in the history
No-Issue

Signed-off-by: James Tanner <[email protected]>
  • Loading branch information
jctanner committed Dec 5, 2023
1 parent d044bf1 commit f48c08e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions galaxy_importer/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ def _extract_archive(fileobj, extract_dir):
for item in tf.getmembers():
if item.name.startswith("/") or "../" in item.name:
raise exc.ImporterError("Invalid file paths detected.")
if item.linkname and (item.linkname.startswith("/") or "../" in item.linkname):
raise exc.ImporterError("Invalid linkname detected.")
if item.linkname:
# Ensure the link target is within the extraction root
link_target = os.path.normpath(os.path.join(extract_dir, item.linkname))
if not link_target.startswith(os.path.abspath(extract_dir)):
raise exc.ImporterError("Invalid link target detected.")
tf.extractall(extract_dir)

0 comments on commit f48c08e

Please sign in to comment.