test: fix docker test-image env and container-specific test guards

Make the full pnpm test:docker suite pass the env-dependent tests (~85 failures):
- Dockerfile.test: ENV LD_LIBRARY_PATH=/usr/local/lib so the built libheif 1.21 is not shadowed by the base image's older system libheif (heif-dec failed with an undefined-symbol error -> 'No HEIF decoder found' on 72 HEIF tests); add libjxl-tools (JXL) and ghostscript + the ImageMagick policy.xml EPS allow-edit.
- docker-compose.test.yml: SYNC_WAIT_MS=30000 so sync-wait image tools do not fall back to 202 under single-container contention (10 tests).
- install_feature.py: guard tarfile.extractall(filter='data') behind Python>=3.12 (bookworm ships 3.11); the manual entry guards already protect.
- feature-status.test.ts / docker-file-secrets.test.ts: skip the two cases that cannot hold inside the container (/.dockerenv always present; root bypasses chmod). Verified on host: all still pass.
This commit is contained in:
SnapOtter
2026-06-17 14:28:41 +08:00
parent b4470cac4b
commit 1f5b222267
5 changed files with 37 additions and 10 deletions
+6 -1
View File
@@ -203,7 +203,12 @@ def safe_extract(tar_path: str, staging_dir: str) -> None:
# Block absolute paths and traversal
if member.name.startswith("/") or ".." in member.name.split("/"):
raise RuntimeError(f"Blocked unsafe tar path: {member.name}")
tf.extractall(staging_dir, filter="data")
# The filter= kwarg was added in Python 3.12; the manual guards above
# already block unsafe entries on older interpreters (e.g. 3.11).
if sys.version_info >= (3, 12):
tf.extractall(staging_dir, filter="data")
else:
tf.extractall(staging_dir)
# -- File move --