Repository navigation
run: refuse capture and dump paths inside the repo - #679
binarycleric wants to merge 1 commit into
Conversation
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 Marvisak#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.
5877782 to
b96c85d
Compare
LAKSHYA-cmd-tech
left a comment
There was a problem hiding this comment.
LGTM! Tested on Windows 11 with MSVC Rust 1.98.1. cargo test -p victory passed cleanly (3 passed, including both new dump path unit tests). Proactively checking VICTORY_CAPTURE, VICTORY_AUDIO_CAPTURE, and VICTORY_XMA_DUMP in
un guarantees compliance with docs/asset-policy.md before any file writes take place.
catminou4
left a comment
There was a problem hiding this comment.
Verified on macOS 26 arm64, rustc 1.98.1:
Conflict with #235 (non-Windows build): check_dump_paths is compiled on all platforms and calls .context(), but #235 gates use anyhow::Context in run.rs to #[cfg(windows)] (nothing else off-Windows uses it). Merging both breaks the app crate off Windows:
error[E0599]: no method named `context` found for enum `Result<T, E>`
--> apps/victory/src/run.rs:23:65
I verified the one-line fix locally (uncommitted): adding use anyhow::Context as _; inside check_dump_paths makes #679 + #235 compile, and the PR's 2 new tests pass on macOS (cargo test -p victory: 2 passed). Worth taking regardless of merge order, since it makes the function self-sufficient.
The dump-path refusal logic itself is platform-independent and its tests run green on macOS with that fix.
|
Independent verification of
AI-assisted; synthetic tests only, no game files. |
Audit: ✅ Looks good (needs Windows to fully compile)Reviewed this PR as part of an audit of mergeable PRs.
No issues found in the diff. |
|
Independent Windows check of
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. |
|
Automated triage for the maintainers. Needs rebase. This PR does not merge cleanly into current The content has not been reviewed yet; it will be once the branch is rebased onto Generated by Claude Code |
…chable-preds-111a Shaders: prune unreachable blocks before SSA renaming (Marvisak#440)
Problem
Three debugging aids write game-derived data to a path taken from the environment, and none of them called
ensure_outside_repo:VICTORY_CAPTUREVICTORY_DUMP_TARGETS)VICTORY_AUDIO_CAPTUREVICTORY_XMA_DUMPScreenshots and audio are exactly what rule #1 keeps out of the repository, and
docs/asset-policy.mdsays everything that writes derived data callsensure_outside_repo. A path in the working tree would put them onegit addaway from a commit.Fix
runchecks all three variables before anything is loaded and stops with the existingPolicyError::InsideRepo, with the variable named as context:The check is in
runrather than at each writer because the writers live invictory-gpuandvictory-hle, which don't depend onvictory-core. The audio recorder is a child process thatrunstarts, so it's covered as well. Same approach as #664 forVICTORY_EMIT_DUMP.Testing
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 --workspaceandcargo xtask policypass; clippy reports nothing in the changed file.victory runwithVICTORY_CAPTUREin the repo is refused before the exe is read; unset, behaviour is unchanged.