Skip to content

Commit

Permalink
make sure nothing in the cmake tar file expands upwards beyond the do…
Browse files Browse the repository at this point in the history
…wnload root directory (charlesnicholson#229)
  • Loading branch information
charlesnicholson authored Oct 24, 2022
1 parent de89d6e commit bd2ed78
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ def get_cmake(download, verbose):
cmake_local_tgz,
verbose)
with tarfile.open(cmake_local_tgz, 'r') as tar:
for member in tar.getmembers():
member_path = pathlib.Path(cmake_local_dir / member.name).resolve()
if not cmake_local_dir in member_path.parents:
raise ValueError('Tar file contents move upwards past sandbox root')
tar.extractall(path=cmake_local_dir)

return cmake_local_exe
Expand Down

0 comments on commit bd2ed78

Please sign in to comment.