VICTORY_WRITE_SITES writes a game-derived file wherever it is pointed, without the ensure_outside_repo check every other writer performs #33
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX#33
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@itsonewi on GitHub · 2026-11-25 23:55 UTC · original
VICTORY_WRITE_SITESis the one path in the tree that writes a game-derived file wherever the user points it, and it is the one that skips the asset-policy check every other writer performs.Where
crates/victory-gpu/src/titlewrite.rs:273-289(learn, diagnostics builds with the switch set):Every line written is
<title module file name> <offset in it>— a title code address, which is exactly whatdocs/asset-policy.mdandcrates/victory-core/src/policy.rs:1-7call game-derived:The shader cache (
victory-pipeline'sCache::open), the cache and data directories (config::subdir) and the crash log all go through that check. This one does not, soVICTORY_WRITE_SITES=victory.txtwhile the working directory is the checkout (which is whatscripts/play.ps1sets,Push-Locationto the repository root) writes the file into the repository.cargo xtask policyonly checks what git tracks, so the stray file sits there unnoticed until someone commits it.Why it is not already handled
victory-gpu's manifest has novictory-coredependency at all (crates/victory-gpu/Cargo.toml:10-17: blake3, zlib-rs, tracing, anyhow, victory-formats, victory-pipeline, victory-shader). Soensure_outside_repois not callable from this file today; the check has to come in throughvictory-pipeline(which has the cache that does call it) or a new dependency onvictory-core.Fix
Before opening the file: resolve it and refuse with one
tracing::warn!when it is inside a source tree — either by exposing a smallvictory_pipeline::outside_repo(path)helper overvictory_core::ensure_outside_repo, or by adding the dependency. The reader side (crates/victory-loader/src/write_sites.rs:287-291) is fine: reading a file the user names is not a write into the tree.Not checked
Source reading at
0a43566. I did not run the title with the switch set, so the file appearing in a checkout is derived from the code (the path is used exactly as given) and not observed.AI use
AI-assisted review (source reading). No build, no run, no game files.
@itsonewi on GitHub · 2026-11-26 00:07 UTC · original
A correction to my own report, after reading
xtask/src/policy.rs: the check does not only look at tracked files, and the hole is worse than I described in a different way.What I got wrong.
list_files(root, false)runsgit ls-files -z --cached --others --exclude-standard(xtask/src/policy.rs:120-126), so untracked files that are not ignored are checked. Avictory.txtwritten into the checkout byVICTORY_WRITE_SITESwould be looked at, not skipped.What that changes. The file would still be accepted, because the check is an allowlist over names, sizes and text shape:
txtis onALLOWED_EXTENSIONS(:17-19), so a.txtname passes.<module file name> <offset>lines are small, contain no NUL byte and no run of more thanMAX_ENCODED_RUN = 512alphanumerics (:169-182), so the content passes too.So the asset-policy check is not a defence here at all: a text file of title code offsets is exactly the shape it is designed to let through, on purpose, because prose and source are that shape. That makes the missing
ensure_outside_repointitlewrite.rs:273-289the only guard, and it is the one that is absent.What I would keep from the original report. Everything about the write path: no check,
victory-gpucannot callensure_outside_repobecause it has novictory-coredependency (crates/victory-gpu/Cargo.toml:10-17), andscripts/play.ps1sets the working directory to the repository root, so a relative path lands in the tree.One extra consequence now visible from
policy.rs. BecauseEXCEPTIONSis keyed on an exact path string (:32-35) andMAX_FILE_SIZEis 640 KiB, adding a second exception would be the path of least resistance for a future contributor who hits this — which is why the guard belongs in the writer, not in the policy's allowlist.(Self-correction, written with AI assistance, from
xtask/src/policy.rsandcrates/victory-gpu/src/titlewrite.rsat0a43566.)