tombox-archive: block colliding entry names #244

Closed
github-bot wants to merge 1 commit from gh-pr/244/head into gh-pr/244/base
Owner

@⁠gringoestrangeiro on GitHub · 2026-11-23 07:09 UTC · original
gringoestrangeiro:archive-block-colliding-names → main · +59 −0 · 2 files · 1 commits · closed without merging

Library / area: tombox-archive (ZIP inventory + extraction-safety validator). No console exports change.

Problem: validate() looked at each central-directory name in isolation, so an archive could carry two entries that resolve to the same path on Windows and still be reported safe to extract. Examples: Game/Content/a.pak plus game/content/A.PAK, or a file Game/Content plus a directory game/content/. Extraction keeps whichever entry lands last, so the file on disk is not the inventory that was vetted.

Change: track normalized names during validation and turn a collision into a blocking finding. Names are compared after separator normalization, trailing-slash removal and lowercasing, which catches case-only duplicates and file/directory collisions. Repeated directory entries stay allowed because they do not overwrite file data.

Tests: cargo test --locked -p tombox-archive passes (18 tests), including the new cases for a case-only duplicate, a file/directory collision, and distinct names plus repeated directories remaining safe. The PR gate reports 0 problems on the diff.

  • cargo test -p tombox-archive passes
  • No game or console files and no binaries included
  • Not applicable: no export status change and no fake success
**@⁠gringoestrangeiro** on GitHub · 2026-11-23 07:09 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/244) `gringoestrangeiro:archive-block-colliding-names` → `main` · +59 −0 · 2 files · 1 commits · closed without merging **Library / area:** `tombox-archive` (ZIP inventory + extraction-safety validator). No console exports change. **Problem:** `validate()` looked at each central-directory name in isolation, so an archive could carry two entries that resolve to the same path on Windows and still be reported safe to extract. Examples: `Game/Content/a.pak` plus `game/content/A.PAK`, or a file `Game/Content` plus a directory `game/content/`. Extraction keeps whichever entry lands last, so the file on disk is not the inventory that was vetted. **Change:** track normalized names during validation and turn a collision into a blocking finding. Names are compared after separator normalization, trailing-slash removal and lowercasing, which catches case-only duplicates and file/directory collisions. Repeated directory entries stay allowed because they do not overwrite file data. **Tests:** `cargo test --locked -p tombox-archive` passes (18 tests), including the new cases for a case-only duplicate, a file/directory collision, and distinct names plus repeated directories remaining safe. The PR gate reports 0 problems on the diff. - [x] `cargo test -p tombox-archive` passes - [x] No game or console files and no binaries included - [x] Not applicable: no export status change and no fake success
validate() checked each central-directory name on its own, so an
archive could carry two entries whose names map to the same path on a
case-insensitive file system (for example Game/Content/a.pak and
game/content/A.PAK) and still report safe to extract. Extraction then
keeps whichever entry lands last, which is not the inventory the
caller vetted.

Treat a repeated normalized name as a blocking finding. Names are
compared after separator normalization, trailing-slash removal and
lowercasing, so a file and a directory with the same name collide too.
Repeated directory entries stay allowed because they do not overwrite
file data.

Tests cover the case-only duplicate, the file/directory collision, and
distinct names plus repeated directories staying safe.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:15:35 +00:00
github-bot closed this pull request 2026-11-26 06:15:35 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 13:45 UTC · original

Applied locally on main with your authorship kept (cherry-picked, bb15e8e); tests pass in a sandbox. It ships in the next release; this PR will be closed when that is pushed. Thanks.

**@⁠omonkeyz** on GitHub · 2026-11-23 13:45 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/244#issuecomment-7102981464) Applied locally on main with your authorship kept (cherry-picked, bb15e8e); tests pass in a sandbox. It ships in the next release; this PR will be closed when that is pushed. Thanks.
Author
Owner

@⁠kiwe147 on GitHub · 2026-11-23 19:15 UTC · original

Tested head 7516c2d24e, applied with git apply (whitespace ignored, the line endings of my checkout differ) on main f89e410, together with #242, #248 (one tree; the PRs touch different files). It applied without conflicts and built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, NVIDIA GeForce RTX 3080 (driver 621.24), MSVC, Rust 1.91.1.

run result
cargo test -p tombox-archive 18 passed, 0 failed

No new failure against main f89e410 in any of these. This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

**@⁠kiwe147** on GitHub · 2026-11-23 19:15 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/244#issuecomment-7111319245) Tested head `7516c2d24e`, applied with `git apply` (whitespace ignored, the line endings of my checkout differ) on `main` `f89e410`, together with #242, #248 (one tree; the PRs touch different files). It applied without conflicts and built. Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, NVIDIA GeForce RTX 3080 (driver 621.24), MSVC, Rust 1.91.1. | run | result | |---|---| | `cargo test -p tombox-archive` | 18 passed, 0 failed | No new failure against `main` `f89e410` in any of these. This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code)
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-25 13:09 UTC · original

Applied on main in bb15e8e (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

**@⁠omonkeyz** on GitHub · 2026-11-25 13:09 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/244#issuecomment-7163366296) Applied on main in bb15e8e (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.