xtask/policy: detect game/shader magics, non-UTF-8 binaries, and symlinks #492
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!492
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-492"
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?
@IlyassRS3 on GitHub · 2026-11-25 01:33 UTC · original
IlyassRS3:fix/xtask-policy-magic-utf8-and-symlinks→main· +70 −4 · 1 files · 1 commits · openSummary
Tightens static Rule #1 enforcement in
xtask/src/policy.rs(cargo xtask policy):RPF7/RPF8/RPF9(RAGE packfiles),SGD5(engine shader archives),RSC7/RSC8(RAGE resources),FSSM(Xbox shader binaries),BKHD(Wwise soundbanks),OggS(Ogg audio),ELF(ELF binaries), and#(SPIR-V binaries) toFORBIDDEN_MAGIC.check()only testedcontent.contains(&0), letting raw non-UTF-8 binary content without0x00bytes pass if given an allowlisted extension such as.txt. Non-UTF-8 content is now explicitly rejected (all 169 existing repository files except the documentedbcpack-tables.binexception are valid UTF-8).WalkDirfiltered out symlinks (is_file()only) andrun()silently ignored anystd::fs::readerror (Err(_) => continue).run()now flags symlinks as policy violations and reports read/metadata errors on existing files (while still skipping deleted tracked files onNotFoundand directory/submodule entries).Verification
1.98.1, no Windows GPU / no game files.cargo test --locked -p xtask: 6 passed, 0 failed (includingrepository_passes_policyand 2 new tests:rejects_game_archive_magics_and_non_utf8_binary_without_nuls,rejects_symlinks_in_tree).cargo clippy --locked -p xtask --all-targets -- -D warnings: 0 warnings.cargo clippy --locked -p xtask --all-targets --target x86_64-pc-windows-msvc -- -D warningsand--all-features: 0 warnings.upstream/main(a803c87): both new tests fail on unpatchedxtask/src/policy.rs(4 passed; 2 failed).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.