Skip to content

Commit

Permalink
raise error when the uploaded tar contain hard/soft link (binary-husk…
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-husky authored Feb 8, 2025
1 parent 991a903 commit 07ece29
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions shared_utils/handle_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ def extract_archive(file_path, dest_dir):
member_path = os.path.normpath(member.name)
full_path = os.path.join(dest_dir, member_path)
full_path = os.path.abspath(full_path)
if member.islnk() or member.issym():
raise Exception(f"Attempted Symlink in {member.name}")
if not full_path.startswith(os.path.abspath(dest_dir) + os.sep):
raise Exception(f"Attempted Path Traversal in {member.name}")

Expand Down

0 comments on commit 07ece29

Please sign in to comment.