HLE media: block UNC share bypasses for localhost and \??\ file URLs #3119
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3121"
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 Arkenoz on 2026-11-26T08:58:00Z.
Summary
Closes two remaining UNC share bypasses in
media::local(crates/victory-hle/src/modules/media.rs) following up on #207:file://localhost/...with extra leading separators:this_machine == truepreviously skippedshare(&whole)completely. Becauseshlwapi.dll!PathCreateFromUrlWconsumes only a single leading separator afterlocalhost, URLs such asfile://localhost///server/share/a.mp4,file://localhost/\\server/share/a.mp4, andfile://localhost/%5C%5Cserver/share/a.mp4resolve to remote UNC paths (\\server\share\a.mp4/\\\server\share\a.mp4) and were allowed through.media::localnow strips one leading separator whenthis_machineis set and still runsshare(...)on the remainder, keepingfile://localhost//server/share/a.mp4(\server\share\a.mp4) local.\??\object-manager prefixes infile:URLs: URLs likefile:///%3F%3F/UNC/server/share/a.mp4decode to\??\UNC\server\share\a.mp4inPathCreateFromUrlWwithout starting with two separators.media::localnow rejects decoded\??\paths unless followed by a drive letter, strippingUNC\case-insensitively when extracting the host.Testing
localhost_and_object_prefix_file_urls_are_refused(verified failing before the fix and passing after) and Windows oracle testthe_host_reads_localhost_and_object_prefix_share_urls_as_sharesagainstshlwapi.dll!PathCreateFromUrlW.rustfmt --edition 2024 --check crates/victory-hle/src/modules/media.rs— passedcargo clippy --workspace --all-targets -- -D warnings— passedcargo check --workspace --all-targets— passedcargo xtask policy— passed (asset policy: 191 files ok)cargo test -p victory-hle --locked— passed (154lib +fidelityfx+no_dll_planting)Coordination & AI disclosure
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T09:09:53Z.
Review: APPROVED
Verified against
origin/main(63bcca4):cargo test -p victory-hle --lib modules::media:: -- --test-threads=1: 7/7 passed (includinglocalhost_and_object_prefix_file_urls_are_refusedandthe_host_reads_localhost_and_object_prefix_share_urls_as_shares).cargo clippy -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly closes the
localhostand\??\UNC share bypasses inmedia.rs.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T09:33:59Z.
Review: CHANGES_REQUESTED
Verified
afd63d5elocally on Windows 11 x64:cargo clippy --all-targets --locked -- -D warnings: clean (3.14s).cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 0 failed (0.34s).cargo test -p victory-hle --locked: 156 passed, 0 failed (154lib including all 7modules::media::tests+1fidelityfx +1no_dll_planting,5.00s).rustfmt --edition 2024 --check crates/victory-hle/src/modules/media.rs: clean.The added
effectiveand\??\checks close the submittedfile://localhost///...,file://localhost/\\...,file://localhost/%5C%5C..., andfile:///%3F%3F/UNC/...cases. However, for non-drivefile:URLs (media.rs:92-116),local()validates decoded Rust views (whole/path) and then returnsOk(with_nul(url)), handing the original raw UTF-16 URL to Media Foundation to re-parse (for example with mixed encoded separators or namespace combinations). Please validate the host-converted path (or hand Media Foundation the exact normalized local path that passed the check) consistently across both resolver entry points, and expand the Windows conversion coverage for mixed separators and percent-encoded slashes.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T09:17:41Z.
Automated triage for the maintainers.
Merge candidate. This makes the URL rule in
media::local(crates/victory-hle/src/modules/media.rs) stricter and loosens nothing. Onmain,!this_machine && share(&whole)skipped the share check for everyfile://localhost/...URL. Now the check runs on every non-drivefile:path, and forlocalhostit runs after removing one leading separator. That refuses everythingmainrefused and alsofile://localhost///server/...,file://localhost/\\server/...and the percent-encoded spelling. The new\??\check on the decoded path refusesfile:///%3F%3F/UNC/server/.... I found no local path that is now wrongly refused, and the controls (localhost//,\??\C:) still pass. The Windows test readsPathCreateFromUrlW's own output, so it backs the claim about host behaviour. Nit: itslocalhost//assertion repeats one inthe_host_reads_those_spellings_as_shares.CI:
checkpassing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Arkenoz on 2026-11-26T10:33:04Z.
Thanks for the thorough review and local verification! That's a good point about validating/passing the host-normalized path rather than the raw UTF-16 URL. Since this PR is intentionally kept minimal and already marked as a merge candidate, I'd prefer to keep it focused on closing the
localhostand\??\bypasses and leave normalizing the return path across both resolver entry points for a separate follow-up PR.Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T20:20:32Z.
NVIDIA full-suite run, to go with the reports above by Dukestar69, fuzeofficlal, since none of them names a GPU run. Tested exact head
afd63d5(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 868 passed, 0 failed, 10 ignored.localhost_and_object_prefix_file_urls_are_refused,the_host_reads_localhost_and_object_prefix_share_urls_as_shares.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.