termux-sync 1.3.7__tar.gz → 1.3.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {termux_sync-1.3.7 → termux_sync-1.3.8}/CHANGELOG.md +7 -0
- {termux_sync-1.3.7 → termux_sync-1.3.8}/PKG-INFO +1 -1
- {termux_sync-1.3.7 → termux_sync-1.3.8}/pyproject.toml +1 -1
- {termux_sync-1.3.7 → termux_sync-1.3.8}/src/termux_sync/__init__.py +18 -3
- {termux_sync-1.3.7 → termux_sync-1.3.8}/.gitignore +0 -0
- {termux_sync-1.3.7 → termux_sync-1.3.8}/LICENSE +0 -0
- {termux_sync-1.3.7 → termux_sync-1.3.8}/README.md +0 -0
|
@@ -11,6 +11,13 @@ Version numbers follow [Semantic Versioning](https://semver.org/).
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
+
## [1.3.8] - 2026-11-19
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- **Restore could still write outside the backed-up folder through links.** The 1.3.7 check only looked at member names. An archive could contain a symbolic link such as `etc -> bin`, or a hard link to an existing file, and then write through it. Every member, and the target of every symbolic or hard link, must now stay inside the folder its archive is restored to (`etc`, `lib` or `home`); anything else is skipped and logged. Relative links that stay inside that folder still work.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
14
21
|
## [1.3.7] - 2026-11-19
|
|
15
22
|
|
|
16
23
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: termux-sync
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.8
|
|
4
4
|
Summary: Backup and restore your entire Termux environment across devices
|
|
5
5
|
Project-URL: Homepage, https://github.com/djunekz/termux-sync
|
|
6
6
|
Project-URL: Repository, https://github.com/djunekz/termux-sync
|
|
@@ -55,7 +55,7 @@ except ImportError:
|
|
|
55
55
|
)
|
|
56
56
|
sys.exit(1)
|
|
57
57
|
|
|
58
|
-
VERSION = "1.3.
|
|
58
|
+
VERSION = "1.3.8"
|
|
59
59
|
APP_NAME = "termux-sync"
|
|
60
60
|
CONFIG_DIR = Path.home() / ".config" / APP_NAME
|
|
61
61
|
CONFIG_FILE = CONFIG_DIR / "config.json"
|
|
@@ -590,7 +590,11 @@ def _safe_extract_member(member: tarfile.TarInfo, dest_path: Path):
|
|
|
590
590
|
raise ValueError(f"Refusing device/fifo entry in archive: {member_name!r}")
|
|
591
591
|
|
|
592
592
|
|
|
593
|
-
def
|
|
593
|
+
def _within(path: Path, root: Path) -> bool:
|
|
594
|
+
return path == root or root in path.parents
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
def _check_member_root(member: tarfile.TarInfo, dest_path: Path, expected_top: str | None):
|
|
594
598
|
if expected_top is None:
|
|
595
599
|
return
|
|
596
600
|
parts = [p for p in Path(member.name).parts if p != "."]
|
|
@@ -598,6 +602,17 @@ def _check_member_root(member: tarfile.TarInfo, expected_top: str | None):
|
|
|
598
602
|
raise ValueError(
|
|
599
603
|
f"Archive member outside expected root {expected_top!r}: {member.name!r}"
|
|
600
604
|
)
|
|
605
|
+
jail = (dest_path / expected_top).resolve()
|
|
606
|
+
target = (dest_path / member.name).resolve()
|
|
607
|
+
if not _within(target, jail):
|
|
608
|
+
raise ValueError(f"Archive member escapes {expected_top!r}: {member.name!r}")
|
|
609
|
+
if member.issym() or member.islnk():
|
|
610
|
+
link_base = dest_path if member.islnk() else target.parent
|
|
611
|
+
resolved_link = (link_base / member.linkname).resolve()
|
|
612
|
+
if not _within(resolved_link, jail):
|
|
613
|
+
raise ValueError(
|
|
614
|
+
f"Archive link escapes {expected_top!r}: {member.name!r} -> {member.linkname!r}"
|
|
615
|
+
)
|
|
601
616
|
|
|
602
617
|
|
|
603
618
|
def extract_archive(
|
|
@@ -616,7 +631,7 @@ def extract_archive(
|
|
|
616
631
|
for member in tf.getmembers():
|
|
617
632
|
try:
|
|
618
633
|
_safe_extract_member(member, dest_path)
|
|
619
|
-
_check_member_root(member, expected_top)
|
|
634
|
+
_check_member_root(member, dest_path, expected_top)
|
|
620
635
|
except ValueError as e:
|
|
621
636
|
log("WARNING", f"Skipped unsafe archive member during restore: {e}")
|
|
622
637
|
continue
|
|
File without changes
|
|
File without changes
|
|
File without changes
|