VFS: a game folder on a network share is not protected from writes (follow-up to #579) #961

Open
opened 2026-11-26 04:38:31 +00:00 by github-bot · 0 comments
Owner

@⁠Conrage on GitHub · 2026-11-24 09:35 UTC · original

Vfs::classify_with returns Target::Pass for every path starting with \\ before it compares the path with the game root:

github.com/ivall/xcl@077ce40/crates/xcl/src/vfs.rs (L270-L272)

let p = strip_verbatim(&p);
if p.starts_with("\\\\") {
    return Target::Pass; // UNC
}

When the game root is itself a UNC path (\\server\share\Game), a title that opens a file by its absolute path (for example one built from GetModuleFileNameW) bypasses the overlay and writes into the game folder. Console paths (D:\x, GAME:\x) are not affected because mounts are applied after this check and the result is compared with the game root.

Today the launcher can't start such a game (it turns \\?\UNC\… into a relative UNC\…), but #579 fixes that. Once #579 merges, this breaks "the game folder is never modified". #316 adds tests asserting that UNC paths pass through, but doesn't cover a UNC game root.

Expected: classify_with(r"\\srv\share\Game\save.dat", …) with game root \\srv\share\Game returns Target::Game { rel: "save.dat" }, as it does for a local root.
Actual (from reading the code): Target::Pass.

Suggested fix: compare with the game root and XCL's own folders before the UNC early return, and let only UNC paths outside them pass. A unit test can inject full the way the existing vfs.rs tests do, so no share is needed.

Not tested: found by reading the code; not run (no Windows machine).

AI use: found, checked and written up by Claude Code (Claude Opus 5.5) at my request.

**@⁠Conrage** on GitHub · 2026-11-24 09:35 UTC · [original](https://github.com/xcl-dev/xcl/issues/961) `Vfs::classify_with` returns `Target::Pass` for every path starting with `\\` before it compares the path with the game root: https://github.com/ivall/xcl/blob/077ce40/crates/xcl/src/vfs.rs#L270-L272 ```rust let p = strip_verbatim(&p); if p.starts_with("\\\\") { return Target::Pass; // UNC } ``` When the game root is itself a UNC path (`\\server\share\Game`), a title that opens a file by its absolute path (for example one built from `GetModuleFileNameW`) bypasses the overlay and writes into the game folder. Console paths (`D:\x`, `GAME:\x`) are not affected because mounts are applied after this check and the result is compared with the game root. Today the launcher can't start such a game (it turns `\\?\UNC\…` into a relative `UNC\…`), but #579 fixes that. Once #579 merges, this breaks "the game folder is never modified". #316 adds tests asserting that UNC paths pass through, but doesn't cover a UNC game root. **Expected:** `classify_with(r"\\srv\share\Game\save.dat", …)` with game root `\\srv\share\Game` returns `Target::Game { rel: "save.dat" }`, as it does for a local root. **Actual (from reading the code):** `Target::Pass`. **Suggested fix:** compare with the game root and XCL's own folders before the UNC early return, and let only UNC paths outside them pass. A unit test can inject `full` the way the existing `vfs.rs` tests do, so no share is needed. **Not tested:** found by reading the code; not run (no Windows machine). **AI use:** found, checked and written up by Claude Code (Claude Opus 5.5) at my request.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:38:31 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.