mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 23:49:56 -04:00
Check zbic's unpacked paths with is_relative_to, which a sibling folder cannot pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -331,7 +331,7 @@ def ensure_zbic(layout, progress=None, cancel=None, log=print, version='dev'):
|
|||||||
with zipfile.ZipFile(dest) as z:
|
with zipfile.ZipFile(dest) as z:
|
||||||
for m in z.infolist():
|
for m in z.infolist():
|
||||||
target = (layout.pydeps / m.filename).resolve()
|
target = (layout.pydeps / m.filename).resolve()
|
||||||
if not str(target).startswith(str(layout.pydeps.resolve())):
|
if not target.is_relative_to(layout.pydeps.resolve()): # not a sibling such as pydeps2 either
|
||||||
raise ToolchainError(f'{pick["filename"]}: unsafe path {m.filename}')
|
raise ToolchainError(f'{pick["filename"]}: unsafe path {m.filename}')
|
||||||
z.extractall(layout.pydeps)
|
z.extractall(layout.pydeps)
|
||||||
dest.unlink(missing_ok=True)
|
dest.unlink(missing_ok=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user