Media: a share is refused however it is spelled #207

Manually merged
github merged 1 commit from gh-pr/207/head into gh-pr/207/base 2026-11-26 03:54:43 +00:00
Owner

@⁠Maraco91 on GitHub · 2026-11-24 01:25 UTC · original
Maraco91:media/unc-forms-are-not-local → main · +103 −5 · 1 files · 1 commits · merged 2026-11-25 00:08 UTC

What

The source-resolver proxy lets a title open local files only (local()), so that Media Foundation cannot fetch over the network past modules::net. It recognises a share as \server\.., //server/.. or file://server/... The host recognises more spellings, and these went through to the host's resolver unchanged:

Title passes local() on main What the host makes of it
/\server\share\a.mp4, \/server/share/a.mp4 "a relative path": passed on \server\share\a.mp4 (GetFullPathNameW)
\??\UNC\server\share\a.mp4 "a relative path": passed on the object manager's spelling of \?\UNC\..; the host's file calls take the prefix as it is
file:////server/share/a.mp4, file://///server/.. "a local file without a drive": passed on \server\share\a.mp4 (PathCreateFromUrlW)
file:\server\share\a.mp4, file:/%5Cserver/share/a.mp4 same \server\share\a.mp4
file:///%5C%5Cserver/share/a.mp4 same \\server\share\a.mp4

Now refused, naming the server, like the spellings already known:

  • a path with two leading separators of either kind;
  • \??\ followed by anything but a drive (the rule \?\ already has);
  • a file: URL that names no host and whose decoded path starts with two separators and is not a drive path.

Unchanged, and checked: \movies\a.mp4 and file:///movies/a.mp4 (one separator), file:////C:/Windows/a.wav (a drive after the slashes: still C:\Windows\a.wav), \??\C:\.., and file://localhost//server/share/a.mp4, which the host reads as the local \server\share\a.mp4.

What I could not check: that Media Foundation's own resolver reads file: URLs the way PathCreateFromUrlW does (it would take a share to test against). I have not seen a title pass such a URL (I have no game files); this closes spellings the rule's own contract says are refused.

Tested

Windows 11 Pro 10.0.26200, rustc 1.98.1 (x86_64-pc-windows-msvc), no game data, no GPU, no network involved (all checks are on strings).

Two new unit tests over one list of spellings:

  • the_host_reads_those_spellings_as_shares (Windows only) pins down the right-hand column above on the host: std::path::absolute for the two path forms, PathCreateFromUrlW for the five URLs, that a \??\ path opens (\??\%SystemRoot%), and the local reading of the three URL controls. It passes on main and with the fix: it is the reference, not the fix's test.
  • shares_are_refused_however_they_are_spelled checks local() refuses all eight, with the scheme and server it reports, and that the five local look-alikes pass as before.

Results:

  • main (d2a4bae) + the tests only: cargo test -p victory-hle --lib media::: shares_are_refused_however_they_are_spelled fails (/\server\share\a.mp4: left: Ok("/\server\share\a.mp4"), right: Err(("unc", "server"))); the host reference passes.
  • with the fix: 4 passed, 0 failed (the 2 existing media tests and the 2 new ones).
  • cargo clippy -p victory-hle --tests: nothing in media.rs. rustfmt --check media.rs: clean.
  • cargo xtask policy --staged: ok.

Not tested: a title run; a real share.

#31 touches the COM release counts in this file, not local().

AI-assisted (Claude Code); the tests above were run on the machine described.

🤖 Generated with Claude Code

**@⁠Maraco91** on GitHub · 2026-11-24 01:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/207) `Maraco91:media/unc-forms-are-not-local` → `main` · +103 −5 · 1 files · 1 commits · merged 2026-11-25 00:08 UTC ## What The source-resolver proxy lets a title open local files only (`local()`), so that Media Foundation cannot fetch over the network past `modules::net`. It recognises a share as `\server\..`, `//server/..` or `file://server/..`. The host recognises more spellings, and these went through to the host's resolver unchanged: | Title passes | `local()` on `main` | What the host makes of it | |---|---|---| | `/\server\share\a.mp4`, `\/server/share/a.mp4` | "a relative path": passed on | `\server\share\a.mp4` (`GetFullPathNameW`) | | `\??\UNC\server\share\a.mp4` | "a relative path": passed on | the object manager's spelling of `\?\UNC\..`; the host's file calls take the prefix as it is | | `file:////server/share/a.mp4`, `file://///server/..` | "a local file without a drive": passed on | `\server\share\a.mp4` (`PathCreateFromUrlW`) | | `file:\server\share\a.mp4`, `file:/%5Cserver/share/a.mp4` | same | `\server\share\a.mp4` | | `file:///%5C%5Cserver/share/a.mp4` | same | `\\server\share\a.mp4` | Now refused, naming the server, like the spellings already known: - a path with two leading separators of either kind; - `\??\` followed by anything but a drive (the rule `\?\` already has); - a `file:` URL that names no host and whose decoded path starts with two separators and is not a drive path. Unchanged, and checked: `\movies\a.mp4` and `file:///movies/a.mp4` (one separator), `file:////C:/Windows/a.wav` (a drive after the slashes: still `C:\Windows\a.wav`), `\??\C:\..`, and `file://localhost//server/share/a.mp4`, which the host reads as the local `\server\share\a.mp4`. What I could not check: that Media Foundation's own resolver reads `file:` URLs the way `PathCreateFromUrlW` does (it would take a share to test against). I have not seen a title pass such a URL (I have no game files); this closes spellings the rule's own contract says are refused. ## Tested Windows 11 Pro 10.0.26200, rustc 1.98.1 (`x86_64-pc-windows-msvc`), no game data, no GPU, no network involved (all checks are on strings). Two new unit tests over one list of spellings: - `the_host_reads_those_spellings_as_shares` (Windows only) pins down the right-hand column above on the host: `std::path::absolute` for the two path forms, `PathCreateFromUrlW` for the five URLs, that a `\??\` path opens (`\??\%SystemRoot%`), and the local reading of the three URL controls. It passes on `main` and with the fix: it is the reference, not the fix's test. - `shares_are_refused_however_they_are_spelled` checks `local()` refuses all eight, with the scheme and server it reports, and that the five local look-alikes pass as before. Results: - `main` (d2a4bae) + the tests only: `cargo test -p victory-hle --lib media::`: `shares_are_refused_however_they_are_spelled` **fails** (`/\server\share\a.mp4`: `left: Ok("/\server\share\a.mp4")`, `right: Err(("unc", "server"))`); the host reference passes. - with the fix: **4 passed, 0 failed** (the 2 existing media tests and the 2 new ones). - `cargo clippy -p victory-hle --tests`: nothing in `media.rs`. `rustfmt --check media.rs`: clean. - `cargo xtask policy --staged`: ok. Not tested: a title run; a real share. #31 touches the COM release counts in this file, not `local()`. AI-assisted (Claude Code); the tests above were run on the machine described. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The source resolver's rule (local files only) knew a share as `\..`,
`//..` or `file://server/..`. The host knows more spellings: any two
leading separators (`/\server\share`), the object manager's prefix
(`\??\UNC\server\share`), and a `file:` URL with no host whose path
starts with two separators (`file:////server/share`,
`file:\server\share`, also percent-encoded). Those fell through as
relative paths or drive-less local files and went to the host's
resolver unchanged.

They are refused now, naming the server. Paths with one leading
separator, a drive after the slashes or the prefix, and the path of a
URL that names this machine pass as before.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:54:41 +00:00
github manually merged commit 11ca3ce492 into gh-pr/207/base 2026-11-26 03:54:43 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:55 UTC · original

Thanks @⁠Maraco91 for adding coverage around share paths that can be disguised by their spelling.

I tested commit 11ca3ce4928cf9ac2f77fcdc1c095d41c62fcbce with:

cargo test --locked -p victory-hle --lib shares -- --test-threads=1

Both targeted tests passed (2 passed, 0 failed; 86 filtered):

This verifies the tested path classification and host URL conversion cases. It does not open a real remote share or exercise media playback.

**@⁠jeremygold02** on GitHub · 2026-11-24 04:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/207#issuecomment-7122458567) Thanks @⁠Maraco91 for adding coverage around share paths that can be disguised by their spelling. I tested commit `11ca3ce4928cf9ac2f77fcdc1c095d41c62fcbce` with: ``` cargo test --locked -p victory-hle --lib shares -- --test-threads=1 ``` Both targeted tests passed (2 passed, 0 failed; 86 filtered): - [`shares_are_refused_however_they_are_spelled`](https://github.com/Marvisak/VIctory/blob/11ca3ce4928cf9ac2f77fcdc1c095d41c62fcbce/crates/victory-hle/src/modules/media.rs#L560) rejects three UNC path spellings and five `file:` URL variants as server shares, while checking that similar local paths and localhost URLs remain accepted. - [`the_host_reads_those_spellings_as_shares`](https://github.com/Marvisak/VIctory/blob/11ca3ce4928cf9ac2f77fcdc1c095d41c62fcbce/crates/victory-hle/src/modules/media.rs#L588) checks Windows path normalization and `PathCreateFromUrlW` results for those URL forms, plus local-path cases. This verifies the tested path classification and host URL conversion cases. It does not open a real remote share or exercise media playback.
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!207
No description provided.