Skip to content

Harden zip extraction against member names Windows cannot write - #389

Merged
abrignoni merged 1 commit into
mainfrom
fix/zip-illegal-filenames
Aug 5, 2026
Merged

Harden zip extraction against member names Windows cannot write#389
abrignoni merged 1 commit into
mainfrom
fix/zip-illegal-filenames

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

Port of iLEAPP commit 5ee6a09e (PR #1879). The failing code path is shared across the LEAPP family.

FileSeekerZip: members with control characters in their names

ZipFile.extract() only replaces a fixed set of printable characters (:<>|"?*) and only on Windows, so ASCII control characters in a member name (observed in a real iOS 26 extraction: chronod icon files like Ƭ\x01\x0e::com.apple.siri.heic) reach the OS untouched and Windows rejects them with EINVAL. The member then silently went missing from the extraction, and worse, the failing member appended the previous member's stale extracted_path to the seeker's result list. Such members are now written manually to a sanitized path inside the data folder on every platform, and sanitize_file_path/sanitize_file_name treat control characters (0x00-0x1F, 0x7F) as illegal.

Tests

11 new tests in admin/test/scripts/test_extraction_illegal_filenames.py (synthetic zips only, no image data), including a path-traversal guard for the manual extraction path.

🤖 Generated with Claude Code

Port of iLEAPP commit 5ee6a09e, which fixed errors surfaced by a Windows
run over an iOS 26 extraction; the failing code path is shared across
the LEAPP family.

FileSeekerZip: zip members whose names carry ASCII control characters
failed to write on Windows with EINVAL and the failing member appended
the previous member's stale path to the result list. Such members are
now written manually to a sanitized path inside the data folder on
every platform, and sanitize_file_path/sanitize_file_name treat
control characters (0x00-0x1F, 0x7F) as illegal.

Regression coverage: 11 tests, synthetic zips only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@abrignoni
abrignoni merged commit 8f92ac9 into main Aug 5, 2026
4 checks passed
@abrignoni
abrignoni deleted the fix/zip-illegal-filenames branch August 5, 2026 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant