Updated to new release v0.9.9
This commit is contained in:
@@ -2135,6 +2135,7 @@ def _verify_retained_release_integrity(
|
||||
|
||||
def _extract_release_archive(archive: Path, destination: Path, version: str) -> None:
|
||||
expected_root = f"{UPDATE_ARCHIVE_PREFIX}{version}"
|
||||
archive_layout: str | None = None
|
||||
seen: set[PurePosixPath] = set()
|
||||
total_bytes = 0
|
||||
try:
|
||||
@@ -2153,11 +2154,29 @@ def _extract_release_archive(archive: Path, destination: Path, version: str) ->
|
||||
if any(part in {"", ".", ".."} for part in raw_parts):
|
||||
raise LauncherUpdateError(f"unsafe launcher archive path: {member.name!r}")
|
||||
path = PurePosixPath(name)
|
||||
if path.is_absolute() or not path.parts or path.parts[0] != expected_root:
|
||||
if path.is_absolute() or not path.parts:
|
||||
raise LauncherUpdateError(
|
||||
f"launcher archive member is outside {expected_root}: {member.name!r}"
|
||||
f"unsafe launcher archive path: {member.name!r}"
|
||||
)
|
||||
relative = PurePosixPath(*path.parts[1:])
|
||||
if path.parts[0] == expected_root:
|
||||
member_layout = "wrapped"
|
||||
elif path.parts[0] in _ALLOWED_RELEASE_ROOTS:
|
||||
member_layout = "flat"
|
||||
else:
|
||||
raise LauncherUpdateError(
|
||||
f"unexpected launcher archive path: {member.name!r}"
|
||||
)
|
||||
if archive_layout is None:
|
||||
archive_layout = member_layout
|
||||
elif archive_layout != member_layout:
|
||||
raise LauncherUpdateError(
|
||||
"launcher archive mixes flat and legacy wrapped paths"
|
||||
)
|
||||
relative = (
|
||||
PurePosixPath(*path.parts[1:])
|
||||
if archive_layout == "wrapped"
|
||||
else path
|
||||
)
|
||||
if not relative.parts:
|
||||
if not member.isdir():
|
||||
raise LauncherUpdateError("launcher archive root must be a directory")
|
||||
@@ -2175,6 +2194,21 @@ def _extract_release_archive(archive: Path, destination: Path, version: str) ->
|
||||
raise LauncherUpdateError(
|
||||
f"unsupported launcher archive member: {member.name!r}"
|
||||
)
|
||||
if (
|
||||
relative.parts[0] == "release.json"
|
||||
and (len(relative.parts) != 1 or not member.isfile())
|
||||
):
|
||||
raise LauncherUpdateError(
|
||||
f"unexpected launcher metadata path: {member.name!r}"
|
||||
)
|
||||
if (
|
||||
len(relative.parts) == 1
|
||||
and relative.parts[0] in {"ptlinux", "ptdiag"}
|
||||
and not member.isdir()
|
||||
):
|
||||
raise LauncherUpdateError(
|
||||
f"launcher package root must be a directory: {member.name!r}"
|
||||
)
|
||||
if member.mode & 0o022:
|
||||
raise LauncherUpdateError(
|
||||
f"launcher archive member is group/world writable: {member.name!r}"
|
||||
|
||||
Reference in New Issue
Block a user