Skip to content

fix(core): refuse a data_dir inside the cache_dir - #224

Closed
mutlusinan wants to merge 1 commit into
trustno1-coder:mainfrom
mutlusinan:fix/core-data-dir-guard
Closed

mutlusinan wants to merge 1 commit into
trustno1-coder:mainfrom
mutlusinan:fix/core-data-dir-guard

Conversation

@mutlusinan

Copy link
Copy Markdown

Problem

data_dir could be set to the cache_dir or to a folder inside it. The cache may be deleted at any time, so saves and settings kept there would go with it, silently.

Fix

Config::resolve refuses a data_dir that is the cache_dir or lies inside it. victory_core::policy::is_within compares resolved whole path components (after symlinks and .., neither path needing to exist), so a sibling such as cache-old is still accepted, and a cache inside the data folder stays allowed.

Verification

  • cargo test -p victory-core — 16 passed, 0 failed, including data_dir_equal_to_cache_dir_is_refused, data_dir_inside_cache_dir_is_refused and sibling_with_similar_prefix_and_cache_inside_data_are_allowed.
  • cargo check --workspace --target x86_64-pc-windows-msvc --locked — clean.

Ported from uiliannn/VItoriaBr 30d9ba1 (pull requests #38 and #42), GPL-3.0.

…coder#38, trustno1-coder#42)

The cache may be deleted at any time; saves and settings kept inside it
would go with it. `is_within` compares resolved whole components, so a
sibling such as `cache-old` is still accepted, and a cache inside the
data folder remains allowed.

Ported from uiliannn/VItoriaBr 30d9ba1 (pull requests trustno1-coder#38 and trustno1-coder#42).
@mutlusinan

Copy link
Copy Markdown
Author

Risk assessment (porting review)

  • Defaults are siblings (%LOCALAPPDATA%/victory/cache and .../data), so no default installation is affected.
  • Behavior change: a victory.toml or environment that puts data_dir inside cache_dir now fails at startup with an explicit message instead of running (and losing saves whenever the cache is cleared). Intended, but it is a hard failure for those setups rather than a warning.
  • is_within resolves symlinks and .. without requiring either path to exist; a sibling with a common prefix (cache-old) and a cache inside the data folder are still accepted (tests cover both).
  • Compatibility: merges cleanly and type-checks against main at e69e39c.

MrSquirrel489 pushed a commit to MrSquirrel489/VIctory-NVIDIA that referenced this pull request Nov 27, 2026
@1tsethan

Copy link
Copy Markdown

Independent Windows validation of PR #224.

Tested commit: 0f52dbd892f2e9af7a84e0edc9bec635ec42dc32.

cargo test --locked -p victory-core

Exit: 0.

  • test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Independent verification with OpenAI Codex assistance. Windows 11 Pro build 26200; Rust 1.98.1 MSVC; Windows SDK libraries from Microsoft.Windows.SDK.CPP.x64 10.0.28000.2957. Test harness used an RTX 3070 Ti / AMD integrated-GPU host; adapter identity was not captured for every test. These are focused checks on the stated PR commit, not gameplay, FPS, or a merged-main integration result.

@cloph-dsp

Copy link
Copy Markdown

Independent local verification of PR #224 (refuse a data_dir equal to or inside the cache_dir).

  • Windows, Rust 1.100.0/MSVC (Scoop rust-msvc, no rustup/clippy), cargo test --locked, synthetic inputs only.
  • Head 0f52dbd892f2e9af7a84e0edc9bec635ec42dc32, merge base 0cef07e9d766df48f0e95f13ce3bbbe2290fe9d3, worktree-local CARGO_TARGET_DIR.
  • Commands:
    • cargo test --locked -p victory-core --lib -- config::tests::data_dir_inside_cache_dir_is_refused --exact --test-threads=1 --quiet → test result: ok. 1 passed; 0 failed; 15 filtered out, exit 0.
    • cargo test --locked -p victory-core --lib -- config::tests --quiet → test result: ok. 11 passed; 0 failed; 5 filtered out, exit 0 (includes the sibling tests data_dir_equal_to_cache_dir_is_refused and sibling_with_similar_prefix_and_cache_inside_data_are_allowed).
  • Negative control: git grep -F data_dir_inside_cache_dir_is_refused 0cef07e9 -- crates/victory-core/src/config.rs → exit 1 (test absent on base).
  • git diff --check 0cef07e9 HEAD clean; diff 2 files, +48/−1.

No full workspace suite or clippy locally. GPU/driver N/A (CPU-only config validation). AI-assisted (Hy4 flash). No game data, assets, extracted shaders, DRM or decrypt.

@trustno1-coder

Copy link
Copy Markdown
Owner

Merged into main (8fc2254) and shipped in v2026.11.27.10. The commit keeps you as its author, so it counts toward the contributors list. GitHub shows this as closed rather than merged only because the commits were applied on top of the newest main (new commit IDs). Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants