Media: refuse a network share after file://localhost too (///server, /%5Cserver, /\\server) #257
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!257
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@sharan104 on GitHub · 2026-11-26 13:31 UTC · original
sharan104:fix/media-audit→main· +22 −6 · 1 files · 1 commits · openThe 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.