fix(web): recognize AppleDouble ZIP metadata #6100

Merged
Zinebyte merged 1 commit from upstream-pr/6100 into main 2026-10-17 10:00:09 +00:00
Zinebyte commented 2026-10-14 22:08:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Zinebyte on 2026-10-14T22:08:23Z.


What

A ZIP with Title/main.elf and Title/sce_module/provider.prx works, but adding the __MACOSX/Title/._main.elf sidecar produced by macOS archive tools prevents the common Title/ directory from being stripped. The browser then rejects the same application with “found 0” executable ELFs.

Recognize the parallel AppleDouble metadata tree only when its files have valid version-2 headers and bounded descriptors, and every sidecar corresponds to an application file or directory. Exclude that recognized tree from root selection and conversion input. Malformed metadata and unrelated entries remain selected, and all original ZIP entries still undergo path, duplicate, encryption, special-file and memory-budget validation.

Add real ZIP regressions to the existing web test job using its already-pinned zip.js dependency. The test additions compose cleanly with #6780 and #6190: the AppleDouble cases precede the existing root-selection cases, and the archive-root regression runs as a separate workflow step before the existing syntax and helper checks. The composed archive-root, batch and output-directory suites pass. Production code and all test assertions are unchanged by this layout adjustment. Apple documents this parallel __MACOSX layout in https://developer.apple.com/forums/thread/690457; the header and descriptor format is specified in https://www.rfc-editor.org/rfc/rfc1740.html#appendix-B.

Tested

Linux, Node.js 22.23.2: the complete archive-root suite and output-directory suite pass. The archive-root suite fails against unchanged main on the metadata-wrapped ZIP. Valid metadata ZIPs retain the original executable and module bytes for Linux and Windows conversion inputs; malformed headers/descriptors, orphan sidecars and unrelated files remain selected. Unsafe paths, duplicates, encrypted entries and special files still fail before filtering. Full ELF/module fixture inputs also remain byte-identical.

Rebased onto main 4524944396. The workflow-equivalent archive-root, module syntax and output-directory checks pass locally. Independent scratch merges with #6780 6737423d02 and #6190 09afe38730 are clean, and both combined archive-root regressions plus the batch/output-directory suites pass. Hosted Web tests passed on exact updated head 3a0b032c59, executing the archive-root regressions and output-directory suite. Conventions and eligibility passed. Local conventions and whitespace checks pass. Independent adversarial review checked malformed payload bounds, short reads and application-only companions. No retail-title or native macOS execution claim.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4865237784 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6100). Originally posted by [Zinebyte](https://github.com/Zinebyte) on 2026-10-14T22:08:23Z. --- ### What A ZIP with `Title/main.elf` and `Title/sce_module/provider.prx` works, but adding the `__MACOSX/Title/._main.elf` sidecar produced by macOS archive tools prevents the common `Title/` directory from being stripped. The browser then rejects the same application with “found 0” executable ELFs. Recognize the parallel AppleDouble metadata tree only when its files have valid version-2 headers and bounded descriptors, and every sidecar corresponds to an application file or directory. Exclude that recognized tree from root selection and conversion input. Malformed metadata and unrelated entries remain selected, and all original ZIP entries still undergo path, duplicate, encryption, special-file and memory-budget validation. Add real ZIP regressions to the existing web test job using its already-pinned zip.js dependency. The test additions compose cleanly with #6780 and #6190: the AppleDouble cases precede the existing root-selection cases, and the archive-root regression runs as a separate workflow step before the existing syntax and helper checks. The composed archive-root, batch and output-directory suites pass. Production code and all test assertions are unchanged by this layout adjustment. Apple documents this parallel `__MACOSX` layout in https://developer.apple.com/forums/thread/690457; the header and descriptor format is specified in https://www.rfc-editor.org/rfc/rfc1740.html#appendix-B. ### Tested Linux, Node.js 22.23.2: the complete archive-root suite and output-directory suite pass. The archive-root suite fails against unchanged main on the metadata-wrapped ZIP. Valid metadata ZIPs retain the original executable and module bytes for Linux and Windows conversion inputs; malformed headers/descriptors, orphan sidecars and unrelated files remain selected. Unsafe paths, duplicates, encrypted entries and special files still fail before filtering. Full ELF/module fixture inputs also remain byte-identical. Rebased onto main `4524944396`. The workflow-equivalent archive-root, module syntax and output-directory checks pass locally. Independent scratch merges with #6780 `6737423d02` and #6190 `09afe38730` are clean, and both combined archive-root regressions plus the batch/output-directory suites pass. Hosted [Web tests](https://github.com/boykopovar/AnyPS5/actions/runs/38927182627) passed on exact updated head `3a0b032c59`, executing the archive-root regressions and output-directory suite. Conventions and eligibility passed. Local conventions and whitespace checks pass. Independent adversarial review checked malformed payload bounds, short reads and application-only companions. No retail-title or native macOS execution claim. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
adriadam10 commented 2026-10-16 22:51:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T22:51:00Z.


Checked the AppleDouble recognition against the diff: archive-root.test.mjs passes on this head and fails with main's archive.mjs ("found 0"). The negative rows (bad magic/version, truncated or oversized descriptor table, overlapping/out-of-range descriptors, orphan sidecars, unrelated __MACOSX entries) stay selected, and the unsafe-path/duplicate/encrypted/special-file checks still run before filtering. output-directory suite passes and Web tests are green on the head; merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6226171663 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6100#issuecomment-6226171663). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-16T22:51:00Z. --- Checked the AppleDouble recognition against the diff: `archive-root.test.mjs` passes on this head and fails with main's `archive.mjs` ("found 0"). The negative rows (bad magic/version, truncated or oversized descriptor table, overlapping/out-of-range descriptors, orphan sidecars, unrelated `__MACOSX` entries) stay selected, and the unsafe-path/duplicate/encrypted/special-file checks still run before filtering. `output-directory` suite passes and Web tests are green on the head; merging.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!6100
No description provided.