core/policy: expand dangling symlinks, reject symlink loops, and handle .. after missing paths #486
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/486"
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 fxceless/victory-fork. Originally posted by IlyassRS3 on 2026-11-25T01:24:57Z.
Summary
Hardens
victory_core::policy::resolve(crates/victory-core/src/policy.rs), which enforces Rule #1 (ensure_outside_repo), to walk components left-to-right and explicitly expand symbolic links (including dangling ones) up to a bounded hop limit (MAX_SYMLINK_HOPS = 40).Bugs fixed
Previously,
resolve()calledstd::fs::canonicalizein a loop and peeled the tail viaPath::file_name()on any error:<outside>/linkis a symlink pointing to<repo>/not-yet-created,canonicalize()fails withNotFound,resolve()peelslinkand returns<outside>/link, andensure_outside_reporeturnsOk(())— allowing caches/outputs to be created inside the repository once the target directory is created.canonicalize()fails withELOOP, which was treated identically toNotFound, peeling the loop component and returningOk(())instead of failing closed...after a non-existent component:Path::file_name()returnsNonefor.., causing valid paths outside the repository like<outside>/missing/..to fail withPolicyError::Io.Implementation notes
RootDirand every existing non-symlink component viastd::fs::canonicalize, and also falls back toread_linkwhencanonicalizefails on a reparse point (such as a dangling NTFS junction) wherefile_type().is_symlink()may be false.#[cfg(unix)]so Windows runners withoutSeCreateSymbolicLinkPrivilegestay green, while running the..regression tests on all platforms.Verification
1.98.1, no Windows GPU / no game files.cargo test --locked -p victory-core -p xtask: 14 passed, 0 failed (victory-core, including 3 new tests:handles_dotdot_after_nonexistent_component,rejects_dangling_symlinks_into_repo,rejects_symlink_loops) + 4 passed, 0 failed (xtask, includingrepository_passes_policy).cargo clippy --locked -p victory-core --all-targets -- -D warnings: 0 warnings.cargo clippy --locked -p victory-core --all-targets --target x86_64-pc-windows-msvc -- -D warningsand--all-features: 0 warnings.upstream/main(a803c87): all 3 new tests fail on unpatchedupstream/main(4 passed; 3 failed).Imported from fxceless/victory-fork. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T01:25:12Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.