Skip to content

Commit f29be7a

Browse files
committed
Harden MPI installer extraction
1 parent d6ee90b commit f29be7a

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

.github/workflows/static-analysis-pr.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ on:
1010
- '**/CMakeLists.txt'
1111
- '**/*.cmake'
1212
- '**/.clang-tidy'
13+
- '.github/actions/setup-mpi-extensions/**'
1314
- '.github/workflows/static-analysis-pr.yml'
1415
- 'scripts/check_task_backend_apis.py'
16+
- 'scripts/install_mpi_extensions.py'
17+
- 'scripts/setup_mpi_extensions.py'
18+
- 'scripts/write_mpi_runtime_env.py'
1519

1620
concurrency:
1721
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}

scripts/install_mpi_extensions.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ def archive_member_path(member: tarfile.TarInfo) -> PurePosixPath:
159159
return member_path
160160

161161

162+
def validate_archive_member_type(member: tarfile.TarInfo) -> None:
163+
if member.isdir() or member.isfile() or member.issym() or member.islnk():
164+
return
165+
raise SystemExit(f"Archive contains unsupported member type: {member.name}")
166+
167+
162168
def validate_archive_link(
163169
member: tarfile.TarInfo,
164170
member_path: PurePosixPath,
@@ -198,6 +204,7 @@ def safe_extract(archive: Path, destination: Path) -> Path:
198204
member_paths = []
199205
for member in members:
200206
member_path = archive_member_path(member)
207+
validate_archive_member_type(member)
201208
roots.add(member_path.parts[0])
202209
member_paths.append((member, member_path))
203210
target = (destination / Path(*member_path.parts)).resolve(strict=False)

0 commit comments

Comments
 (0)