HLE media: block UNC share bypasses for localhost and \??\ file URLs #3121

Open
github-bot wants to merge 1 commit from github-bot/gh-3121 into main AGit
Owner

@⁠Arkenoz on GitHub · 2026-11-26 08:58 UTC · original
Arkenoz:fix/media-local-unc-bypasses → main · +76 −4 · 1 files · 1 commits · open

Summary

Closes two remaining UNC share bypasses in media::local (crates/victory-hle/src/modules/media.rs) following up on #207:

  1. file://localhost/... with extra leading separators: this_machine == true previously skipped share(&whole) completely. Because shlwapi.dll!PathCreateFromUrlW consumes only a single leading separator after localhost, URLs such as file://localhost///server/share/a.mp4, file://localhost/\\server/share/a.mp4, and file://localhost/%5C%5Cserver/share/a.mp4 resolve to remote UNC paths (\\server\share\a.mp4 / \\\server\share\a.mp4) and were allowed through. media::local now strips one leading separator when this_machine is set and still runs share(...) on the remainder, keeping file://localhost//server/share/a.mp4 (\server\share\a.mp4) local.
  2. Percent-encoded \??\ object-manager prefixes in file: URLs: URLs like file:///%3F%3F/UNC/server/share/a.mp4 decode to \??\UNC\server\share\a.mp4 in PathCreateFromUrlW without starting with two separators. media::local now rejects decoded \??\ paths unless followed by a drive letter, stripping UNC\ case-insensitively when extracting the host.

Testing

  • Added localhost_and_object_prefix_file_urls_are_refused (verified failing before the fix and passing after) and Windows oracle test the_host_reads_localhost_and_object_prefix_share_urls_as_shares against shlwapi.dll!PathCreateFromUrlW.
  • rustfmt --edition 2024 --check crates/victory-hle/src/modules/media.rs — passed
  • cargo clippy --workspace --all-targets -- -D warnings — passed
  • cargo check --workspace --all-targets — passed
  • cargo xtask policy — passed (asset policy: 191 files ok)
  • cargo test -p victory-hle --locked — passed (154 lib + fidelityfx + no_dll_planting)

Coordination & AI disclosure

  • Claimed in #1633.
  • AI-assisted (Antigravity / Gemini 4 Neon).
**@⁠Arkenoz** on GitHub · 2026-11-26 08:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/3121) `Arkenoz:fix/media-local-unc-bypasses` → `main` · +76 −4 · 1 files · 1 commits · open ### Summary Closes two remaining UNC share bypasses in `media::local` (`crates/victory-hle/src/modules/media.rs`) following up on #207: 1. **`file://localhost/...` with extra leading separators:** `this_machine == true` previously skipped `share(&whole)` completely. Because `shlwapi.dll!PathCreateFromUrlW` consumes only a single leading separator after `localhost`, URLs such as `file://localhost///server/share/a.mp4`, `file://localhost/\\server/share/a.mp4`, and `file://localhost/%5C%5Cserver/share/a.mp4` resolve to remote UNC paths (`\\server\share\a.mp4` / `\\\server\share\a.mp4`) and were allowed through. `media::local` now strips one leading separator when `this_machine` is set and still runs `share(...)` on the remainder, keeping `file://localhost//server/share/a.mp4` (`\server\share\a.mp4`) local. 2. **Percent-encoded `\??\` object-manager prefixes in `file:` URLs:** URLs like `file:///%3F%3F/UNC/server/share/a.mp4` decode to `\??\UNC\server\share\a.mp4` in `PathCreateFromUrlW` without starting with two separators. `media::local` now rejects decoded `\??\` paths unless followed by a drive letter, stripping `UNC\` case-insensitively when extracting the host. ### Testing - Added `localhost_and_object_prefix_file_urls_are_refused` (verified failing before the fix and passing after) and Windows oracle test `the_host_reads_localhost_and_object_prefix_share_urls_as_shares` against `shlwapi.dll!PathCreateFromUrlW`. - `rustfmt --edition 2024 --check crates/victory-hle/src/modules/media.rs` — passed - `cargo clippy --workspace --all-targets -- -D warnings` — passed - `cargo check --workspace --all-targets` — passed - `cargo xtask policy` — passed (`asset policy: 191 files ok`) - `cargo test -p victory-hle --locked` — passed (`154` lib + `fidelityfx` + `no_dll_planting`) ### Coordination & AI disclosure - Claimed in #1633. - AI-assisted (Antigravity / Gemini 4 Neon).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:03:05 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3121/head:github-bot/gh-3121'
git switch 'github-bot/gh-3121'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3121'
git switch 'github-bot/gh-3121'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3121'
git switch 'github-bot/gh-3121'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3121'
git switch 'main'
git merge --squash 'github-bot/gh-3121'
git switch 'main'
git merge --ff-only 'github-bot/gh-3121'
git switch 'main'
git merge 'github-bot/gh-3121'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3121
No description provided.