Media: refuse a network share after file://localhost too (///server, /%5Cserver, /\\server) #257
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/257"
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 avatarmanz/VIctory-7900XTX. Originally posted by sharan104 on 2026-11-26T13:31:30Z.
The media source resolver's local-files rule (
media.rs,local()) lets anyfile:URL that names this machine through as a local file. That's becausefile://localhost//moviesis\moviesto the host. But the host drops only one of two leading separators after the host name, so these three spellings all reach the host's resolver unchanged, pastmodules::net:file://localhost///server/share/a.mp4file://localhost/%5Cserver/share/a.mp4file://localhost/\\server/share/a.mp4They all mean
\\server\share\a.mp4.I checked this with Media Foundation on Windows 11.
file://localhost///127.0.0.1/C$/Windows/Media/chimes.wavopens a file through the admin share (S_OK). An unknown server fails withERROR_BAD_NETPATH, which shows it was treated as a network path. So a title, or a video URL inside its data, could make us open files on network shares, the exact thing this rule is there to refuse.The gap came from
fc0d5e7, which deliberately exempted URLs naming this machine.Fix: after a host name, one of two leading separators is dropped before the share check, as the host does. The share check now runs whether or not a host is named.
file://localhost//server/shareand its backslash spelling still pass as local paths (\server\share), as before.Tests:
SHARE_URLS.shares_are_refused_however_they_are_spelledfails without the fix (left: Ok("file://localhost///server/share/a.mp4")) and passes with it.the_host_reads_those_spellings_as_sharesconfirms Media Foundation reads each new spelling as a share.Results:
cargo test -p victory-hle --locked: 155 passed, 0 failed, 2 ignored. The media tests passed 10 out of 10 runs.cargo clippy -p victory-hle --all-targets --locked --no-deps -- -D warningsis clean, with and without--all-features.🤖 Generated with Claude Code
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.