App: enforce asset policy check in default_paths #535
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/535"
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?
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T04:35:28Z.
Motivation
apps/victory/src/main.rs:default_pathsresolves paths supplied either via the command line or fromvictory.toml(game_dirandtest_titles). Previously, it returned these paths without validating that they are outside the repository according to VIctory's asset policy (Rule #1).While
show_configlogged policy violations, commands relying ondefault_paths(census,shader-info,translate) did not enforcevictory_core::ensure_outside_repo(&p).Solution
default_pathswithvictory_core::ensure_outside_repo(p)?prior to returning.apps/victory/src/main.rsverifying that paths inside the repository are rejected and paths outside the repository are accepted.No game files used.
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T04:51:27Z.
### Technical Verification & Implementation Details
Context & Root Cause
In
apps/victory/src/main.rs,default_pathsresolves paths supplied on the CLI or fromvictory.toml(game_dirandtest_titles) forcensus,shader-info, andtranslate. Previously, it returned these paths without validating that they are outside the repository according to VIctory's asset policy (Rule #1).Changes & Diff
victory_core::ensure_outside_repo(p)?prior to returning.default_paths_enforces_outside_repo(rejecting repository paths) anddefault_paths_accepts_outside_path.Git Log Line & Verification
ext 8cc7bd2 App: enforce asset policy check in default_paths apps/victory/src/main.rs | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-)cargo xtask policy(Rule #1 compliance, zero game assets).rustfmt --edition 2024.Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T06:24:23Z.
### Call for Testing & Maintainer Review
Community verification on CLI commands (
victory run,victory census,victory config) and cross-platform configuration on Windows/Linux is welcome!cargo xtask policypassing).@Marvisak: Ready for maintainer review and merge when convenient!
Imported from Marvisak/VIctory. Originally posted by KevinPratap on 2026-11-24T07:22:11Z.
Heads-up: with this merged, #115's census tests fail (they pass the crate's own
Cargo.tomlas input, whichdefault_pathsnow refuses as inside the source tree). Verified onmain+ #115 + #535: bothcensustests FAILED. The tests are what should change; a fix against #115's branch: https://github.com/ZekkJJ/VIctory/pull/1 (then 2 passed with this PR merged too). AI-assisted.Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T07:32:44Z.
Thanks for the heads-up and verification @KevinPratap!
You're spot on: passing files inside the repository (like
Cargo.toml) directly violates Rule #1 andensure_outside_repo, so #115's tests pointing inside the source tree are indeed what should be updated (e.g. using a temporary directory fixture outside the repository). Great to see your fix in https://github.com/ZekkJJ/VIctory/pull/1 makes both tests pass with this PR merged as well!Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T08:40:51Z.
Review: COMMENTED
Tested
8cc7bd2on Windows 11, RTX 5070, MSVC:cargo test --workspace --no-fail-fastpasses (266 passed, 0 failed).The code does what it says, but I'm not convinced the check belongs on these paths:
ensure_outside_repois there to keep derived data and title files from being written into the repo: the config's data, cache and game directories, so nothing proprietary gets committed by accident.default_pathsfeeds three read-only analysis commands (census,shader-info,translate). Reading a path inside the repo can't put title data into it.victory shader-info ./my-synthetic.dxbcfrom a checkout is refused with an asset-policy error, which reads as an accusation.game_dirandtest_titlesare already checked where the config is resolved (show_configreports them, andsubdirenforces it for derived directories).If the goal is to stop people storing a game inside the checkout, a warning when a configured
game_dirresolves inside the repo would make that point without blocking reads. Comment rather than a change request, since this is a policy call for the maintainers.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T11:27:24Z.
Thanks @mercuryVM for the insightful architectural distinction!
You are completely right: read-only analysis tools (\census, \shader-info, \ ranslate) need to inspect synthetic in-repo test fixtures (like \ ests/fixtures\ or #115's test cases) without triggering an asset policy error. Hard-blocking reads inside the repo was conflating read-only analysis with writing derived data.
I've updated the branch in commit \
ebfa8ae\ so that:Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T12:13:19Z.
Review: COMMENTED
Re-tested
ebfa8aeon Windows 11, RTX 5070, MSVC:cargo test -p victory3 passed, includingdefault_paths_accepts_cli_paths.This resolves my earlier point that the check blocked synthetic in-tree inputs: explicit CLI paths are now taken as given. But the PR now no longer enforces anything for configured paths. Its title says "enforce asset policy check in default_paths", and the code now does the opposite:
main.rs(default_paths): agame_dir/test_titlesfrom config that resolves inside the checkout now only printsPOLICY WARNINGto stderr and carries on. Before this commit it was an error. The asset policy (README,policy.rs) is a refusal, not a warning, and a configured game folder inside the repo is the case it exists for.ensure_outside_repo(p)?and exempt only explicit CLI paths, which this commit already does. Then the PR title and behaviour line up. It's a maintainer policy call, so leaving it as a comment.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T12:48:54Z.
Review: COMMENTED
Static review (app crate doesn't build on macOS — the known
host_resourcecfg issue, fixed by #235/#523 — so nothing here was compiled or run).The logic is correct:
default_pathsreturns CLI paths early (Ok(paths)) before the configured-paths branch, so the newensure_outside_repoloop only guards paths coming fromvictory.toml/env — matching the asset policy (CLI paths may be synthetic in-tree fixtures, configured paths must stay outside the repo). That matches the existingconfigcommand's POLICY VIOLATION reporting.One test-quality nit:
default_paths_rejects_configured_inside_repodoesn't calldefault_pathsat all — it callsvictory_core::ensure_outside_repodirectly, so the new loop indefault_pathsitself has no coverage (testing it needs aConfig::loadwith a config file, which is env-dependent). The other two tests do exercisedefault_pathsproperly. Non-blocking.Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T12:34:57Z.
Thanks @mercuryVM! You're completely right on aligning behavior and intent: the core requirement of Rule #1 is that configured directories in
victory.toml(game_dir,test_titles) must never point into the repository, whereas explicit CLI arguments passed to analysis tools (census,shader-info,translate) legitimately inspect in-tree test fixtures.I've updated the branch in commit
4307207so that:if !paths.is_empty() { return Ok(paths); }).victory.tomlstrictly enforcevictory_core::ensure_outside_repo(p)?, rejecting any in-repo configured path with an error.The PR title, behavior, and policy guarantees now align completely.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:22:53Z.
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main(conflict inapps/victory/src/main.rs). It will be reviewed again once it is rebased.From the earlier needs-work note, still open: name an output the new
default_pathsguard protects that is not already covered, and add a test that reaches the new branch indefault_paths.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-26T15:19:17Z.
Closing this PR as superseded on
main:mainnow hascheck_policy(victory config --check) inapps/victory/src/main.rs, which validates configuredgame_dir,test_titles,cache_dir, anddata_diragainstvictory_core::ensure_outside_repo.default_pathsfeeds read-only analysis commands (census,shader-info,translate) where synthetic in-repo fixtures are valid, as @mercuryVM and triage noted.Thank you to @mercuryVM, @KevinPratap, and triage for the review!
AI-assisted: yes (Gemini 4 Neon)
Pull request closed