run: refuse capture and dump paths inside the repo #679

Open
github-bot wants to merge 1 commit from github-bot/gh-679 into main AGit
Owner

@⁠binarycleric on GitHub · 2026-11-24 06:43 UTC · original
binarycleric:fix/dump-paths-outside-repo → main · +60 −0 · 1 files · 1 commits · open

Problem

Three debugging aids write game-derived data to a path taken from the environment, and none of them called ensure_outside_repo:

Variable Writes
VICTORY_CAPTURE presented frames as PNG (and render targets with VICTORY_DUMP_TARGETS)
VICTORY_AUDIO_CAPTURE a WAV of the title's audio
VICTORY_XMA_DUMP XMA voice context and input

Screenshots and audio are exactly what rule #1 keeps out of the repository, and docs/asset-policy.md says everything that writes derived data calls ensure_outside_repo. A path in the working tree would put them one git add away from a commit.

Fix

run checks all three variables before anything is loaded and stops with the existing PolicyError::InsideRepo, with the variable named as context:

Error: VICTORY_CAPTURE

Caused by:
    refusing to use C:\...\VIctory\frames for game-derived data: it is inside the VIctory source tree ...

The check is in run rather than at each writer because the writers live in victory-gpu and victory-hle, which don't depend on victory-core. The audio recorder is a child process that run starts, so it's covered as well. Same approach as #664 for VICTORY_EMIT_DUMP.

Testing

  • New tests in apps/victory/src/run.rs: each variable is refused for paths inside the repo, and outside or unset paths pass. The helper takes the environment as a closure, so the tests don't mutate process env.
  • cargo test --workspace and cargo xtask policy pass; clippy reports nothing in the changed file.
  • Manually: victory run with VICTORY_CAPTURE in the repo is refused before the exe is read; unset, behaviour is unchanged.
**@⁠binarycleric** on GitHub · 2026-11-24 06:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/679) `binarycleric:fix/dump-paths-outside-repo` → `main` · +60 −0 · 1 files · 1 commits · open ## Problem Three debugging aids write game-derived data to a path taken from the environment, and none of them called `ensure_outside_repo`: | Variable | Writes | |---|---| | `VICTORY_CAPTURE` | presented frames as PNG (and render targets with `VICTORY_DUMP_TARGETS`) | | `VICTORY_AUDIO_CAPTURE` | a WAV of the title's audio | | `VICTORY_XMA_DUMP` | XMA voice context and input | Screenshots and audio are exactly what rule #1 keeps out of the repository, and `docs/asset-policy.md` says everything that writes derived data calls `ensure_outside_repo`. A path in the working tree would put them one `git add` away from a commit. ## Fix `run` checks all three variables before anything is loaded and stops with the existing `PolicyError::InsideRepo`, with the variable named as context: ``` Error: VICTORY_CAPTURE Caused by: refusing to use C:\...\VIctory\frames for game-derived data: it is inside the VIctory source tree ... ``` The check is in `run` rather than at each writer because the writers live in `victory-gpu` and `victory-hle`, which don't depend on `victory-core`. The audio recorder is a child process that `run` starts, so it's covered as well. Same approach as #664 for `VICTORY_EMIT_DUMP`. ## Testing - New tests in `apps/victory/src/run.rs`: each variable is refused for paths inside the repo, and outside or unset paths pass. The helper takes the environment as a closure, so the tests don't mutate process env. - `cargo test --workspace` and `cargo xtask policy` pass; clippy reports nothing in the changed file. - Manually: `victory run` with `VICTORY_CAPTURE` in the repo is refused before the exe is read; unset, behaviour is unchanged.
VICTORY_CAPTURE (presented frames as PNG), VICTORY_AUDIO_CAPTURE (a WAV
of the title's audio) and VICTORY_XMA_DUMP (XMA voice input) write
game-derived data to a path taken from the environment, and none of them
checked it with ensure_outside_repo. `run` now checks all three before
anything is loaded, so a path in the source tree stops the run instead
of filling the working tree with assets (rule #1).

Checked in `run` because the writers live in victory-gpu and
victory-hle, which do not depend on victory-core; the audio recorder is
a child that `run` starts, so it is covered too.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:12:41 +00:00
Author
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 10:08 UTC · original

Independent verification of b96c85d47 merged with main (ffe310e, clean merge) on Windows 11 Pro (26100), Rust 1.98.1 (x86_64-pc-windows-msvc): PASS.

  • cargo xtask policy → asset policy: 154 files ok
  • cargo clippy --workspace --all-targets --locked -- -D warnings → pass (0 warnings)
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings → pass (0 warnings)
  • cargo test -p victory --locked → 3 passed, 0 failed (both new run::dump_path_tests::dump_paths_inside_the_repo_are_refused and dump_paths_outside_the_repo_and_unset_ones_pass pass)
  • Diff review: check_dump_paths runs before title loading / Config::load, covers all three env vars (VICTORY_CAPTURE, VICTORY_AUDIO_CAPTURE, VICTORY_XMA_DUMP) with variable-name context, and refusing empty-string values when cwd is inside the repo matches capture.rs:15 and audio.rs:631 (which also check var_os directly without ignoring empty strings).

AI-assisted; synthetic tests only, no game files.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 10:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/679#issuecomment-7128378577) Independent verification of `b96c85d47` merged with `main` (`ffe310e`, clean merge) on Windows 11 Pro (`26100`), Rust `1.98.1` (`x86_64-pc-windows-msvc`): **PASS**. - `cargo xtask policy` → `asset policy: 154 files ok` - `cargo clippy --workspace --all-targets --locked -- -D warnings` → **pass** (0 warnings) - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` → **pass** (0 warnings) - `cargo test -p victory --locked` → **3 passed, 0 failed** (both new `run::dump_path_tests::dump_paths_inside_the_repo_are_refused` and `dump_paths_outside_the_repo_and_unset_ones_pass` pass) - Diff review: `check_dump_paths` runs before title loading / `Config::load`, covers all three env vars (`VICTORY_CAPTURE`, `VICTORY_AUDIO_CAPTURE`, `VICTORY_XMA_DUMP`) with variable-name context, and refusing empty-string values when `cwd` is inside the repo matches `capture.rs:15` and `audio.rs:631` (which also check `var_os` directly without ignoring empty strings). AI-assisted; synthetic tests only, no game files.
Author
Owner

@⁠ErRusso on GitHub · 2026-11-24 11:23 UTC · original

Audit: ✅ Looks good (needs Windows to fully compile)

Reviewed this PR as part of an audit of mergeable PRs.

  • Scope: apps/victory/src/run.rs (+60/-0). Adds check_dump_paths() which validates VICTORY_CAPTURE, VICTORY_AUDIO_CAPTURE, and VICTORY_XMA_DUMP against ensure_outside_repo() before the title can write anything. Includes tests that verify inside-repo paths (both file and dir) are refused and temp-dir paths pass. check_dump_paths takes an environment closure, making it testable without actual env vars.
  • Merges cleanly into main.
  • Test note: The dump_path_tests module depends on the victory binary crate which transitively depends on victory-gpu, which doesn't compile on Linux (pre-existing #[cfg(windows)] gating gap). The test logic is straightforward: ensure_outside_repo is already tested in victory-core.

No issues found in the diff.

**@⁠ErRusso** on GitHub · 2026-11-24 11:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/679#issuecomment-7130036508) ## Audit: ✅ Looks good (needs Windows to fully compile) Reviewed this PR as part of an audit of mergeable PRs. - **Scope:** `apps/victory/src/run.rs` (+60/-0). Adds `check_dump_paths()` which validates `VICTORY_CAPTURE`, `VICTORY_AUDIO_CAPTURE`, and `VICTORY_XMA_DUMP` against `ensure_outside_repo()` before the title can write anything. Includes tests that verify inside-repo paths (both file and dir) are refused and temp-dir paths pass. `check_dump_paths` takes an environment closure, making it testable without actual env vars. - **Merges cleanly** into `main`. - **Test note:** The `dump_path_tests` module depends on the `victory` binary crate which transitively depends on `victory-gpu`, which doesn't compile on Linux (pre-existing `#[cfg(windows)]` gating gap). The test logic is straightforward: `ensure_outside_repo` is already tested in `victory-core`. No issues found in the diff.
Author
Owner

@⁠molodayamama on GitHub · 2026-11-24 14:02 UTC · original

Independent Windows check of b96c85d47d7c5d9b2e7f1673e0a59deb36c4aa31 (Windows 10 22H2 19045, Rust 1.98.1, MSVC x64).

  • cargo test -p victory --locked --bin victory dump_paths_ -- --test-threads=1 --nocapture: 2 passed.

The synthetic path fixtures cover refusing capture/dump paths inside the repository while accepting paths outside it and unset settings. This exercises the guard directly.

Only source-built synthetic fixtures were used. AI-assisted verification.

**@⁠molodayamama** on GitHub · 2026-11-24 14:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/679#issuecomment-7133736007) Independent Windows check of `b96c85d47d7c5d9b2e7f1673e0a59deb36c4aa31` (Windows 10 22H2 19045, Rust 1.98.1, MSVC x64). - `cargo test -p victory --locked --bin victory dump_paths_ -- --test-threads=1 --nocapture`: 2 passed. The synthetic path fixtures cover refusing capture/dump paths inside the repository while accepting paths outside it and unset settings. This exercises the guard directly. Only source-built synthetic fixtures were used. AI-assisted verification.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:34 UTC · original

Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: apps/victory/src/run.rs.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/679#issuecomment-7148649547) <!-- victory-triage v1 head=b96c85d47d7c5d9b2e7f1673e0a59deb36c4aa31 verdict=needs-rebase at=2026-11-25T00:13:20Z --> Automated triage for the maintainers. **Needs rebase.** This PR does not merge cleanly into current `main` (ac2525d). Conflicting files: `apps/victory/src/run.rs`. The content has not been reviewed yet; it will be once the branch is rebased onto `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • apps/victory/src/run.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/679/head:github-bot/gh-679'
git switch 'github-bot/gh-679'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-679'
git switch 'github-bot/gh-679'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-679'
git switch 'github-bot/gh-679'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-679'
git switch 'main'
git merge --squash 'github-bot/gh-679'
git switch 'main'
git merge --ff-only 'github-bot/gh-679'
git switch 'main'
git merge 'github-bot/gh-679'
git push origin 'main'
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!679
No description provided.