比较提交

...

1 次代码提交

作者 SHA1 备注 提交日期
binary-husky
59e3d3bf73 raise error when the uploaded tar contain hard/soft link 2025-02-07 21:22:46 +08:00

查看文件

@@ -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}")