Unsafe writing of tar file in recirq/documentation_utils.py
CodeQL scanning alerts flagged recirq/documentation_utils.py:72 for an unsafe action: it downloads a tar file from a 3rd-party site and then extracts it without validating the paths inside the tar file.
From the alert:
Extracting files from a malicious tar archive without validating that the destination file path is within the destination directory can cause files outside the destination directory to be overwritten, due to the possible presence of directory traversal elements (..) in archive paths.
The code in question:
python
stream = urllib.request.urlopen("https://ndownloader.figshare.com/files/25541666")
with tarfile.open(fileobj=stream, mode='r|xz') as tf:
tf.extractall(path=base_dir)