HLE: harden storage and xpackage against path traversal and malformed inputs (fixes #1375) #2316
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2318"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T10:28:56Z.
Summary
Rebased
test/hle-storage-hardening(324dc7b) cleanly ontomain(940d32f) as requested in #1375.crates/victory-hle/src/modules/files.rs: resolves.and..for short title paths as well as verbatim paths so traversal cannot escape the mounted drive root.crates/victory-hle/src/modules/xpackage.rs: guardsestimate_downloadnull pointers before writing*confirm = falseand validates malformed/truncated package identifiers.crates/victory-hle/src/modules/storage.rs&runtime.rs: storage quota checks and unit tests.Tests
cargo test -p victory-hle --lib— 149 passed, 0 failedcargo clippy -p victory-hle --all-targets -- -D warnings— 0 warningscargo xtask policy— 182 files okImported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T10:44:24Z.
Review: COMMENTED
Verified against
origin/main(940d32f):storage(20/20) andfiles(8/8) tests pass,cargo clippy -p victory-hle --all-targets -- -D warningshas 0 warnings, andcargo xtask policypasses (183 files ok).modules::xpackage::tests: Runningcargo test -p victory-hle xpackagewith default parallel test threads fails: Running with-- --test-threads=1passes 4/4, confirming the newxpackage::testsrace on shared global runtime state withthe_installation_is_complete_and_alone. Serializing thexpackage::teststhat touch global runtime state with a sharedMutexshould eliminate this flake under defaultcargo test.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:54:05Z.
Review: COMMENTED
HLE: harden storage/xpackage against path traversal — normalize_parts resolves . and .. inside verbatim() (.. stops at root) (+468). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Security-relevant hardening; good.
Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T10:55:59Z.
Thanks for catching that! Locked
crate::runtime::TEST_TITLE_LOCKinthe_installation_is_complete_and_aloneand amended (a1f8e1d). Re-rancargo test -p victory-hle --lib xpackage5x under default parallel threads (4/4 each),cargo test -p victory-hle --lib(149/149),cargo clippy -p victory-hle --all-targets -- -D warnings(0 warnings), andcargo xtask policy(182 files ok).Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:26:35Z.
Automated triage for the maintainers.
Merge candidate (worth a look). On
main,files::translateresolved.and..(stopping at the root) only for long paths, inverbatim; short paths went to the host as they were, so a title path likeX:\..\filewas resolved by Win32 to the parent of the mounted folder. This PR moves that resolution intonormalize_partsand uses it whenever the tail has a..part, so short paths behave like long ones. It also stopsestimate_downloadinxpackage.rsfrom writing*confirmbefore failing on a nullbytes. I checked the new branch against the existingX:nameand verbatim-prefix handling and the vtable offsets the new tests call; the tests take a newTEST_TITLE_LOCKaround the global title. The xpackage tests mostly pin existing behaviour and could be trimmed. Linked issue #1375 is confirmed. CI: passing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:08:21Z.
Automated triage for the maintainers, second look (a review against current
main, with builds and tests where they could change the verdict).Closing in favour of #182 for the traversal fix (the bug is real). Here the
has_traversalbranch drops a trailing separator, soX:\a\..\b\becomes<root>\band a file opened with a trailing backslash succeeds where Windows fails, and it also rewrites\\?\-prefixed paths, which #182 deliberately leaves alone. The xpackage null guard changes behaviour only for a null out pointer, and most of the new tests pin existing behaviour.If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
Pull request closed