Repository navigation
Conversation
check() accepted any 7+ character token on an xcl-smoke block's commit line and passed it verbatim to gh api repos/<repo>/compare/<sha>...main (under pull_request_target) and git merge-base --is-ancestor. Symbolic refs and rev expressions such as refs/heads/main and main~00 return identical from GitHub's compare API (and origin/main / HEAD~000 exit 0 locally), so a smoke block could satisfy the main-baseline check without naming a real commit hash. Arbitrary path segments (../../pulls, query strings) and leading-dash git options (--version) were also passed through unvalidated. Validate commit tokens as 7-40 hex digits via commit_sha() before matching head or calling is_main_ancestor(), normalize to lowercase for comparison, and guard is_main_ancestor() with the same pattern. Assisted-by: Antigravity (Gemini 4 Neon)
Owner
Author
|
Upstream PR xcl-dev#1141 was closed or merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
scripts/pr_check.pyaccepted any 7+ character token on anxcl-smokeblock'scommit:line and passed it verbatim togh api repos/<repo>/compare/<sha>...main(running underpull_request_target) andgit merge-base --is-ancestor.As a result, symbolic refs and rev expressions such as
refs/heads/mainandmain~00returnedidenticalfrom GitHub's compare API (andorigin/main/HEAD~000exited0locally), passing the main-baseline check without naming any commit hash. Untrusted path segments (../../pulls, query strings) and leading-dash git flags (--version) were also interpolated directly into those calls.Note on overlap with xcl-dev#834: xcl-dev#834 checks the first word's length (≥ 7) to reject short prefixes like
1 some other, but still allows non-hex refs, paths, and options through tois_main_ancestor(). Validating 7–40 hex digits handles both.What is in it
scripts/pr_check.py: addCOMMIT_SHA([0-9a-f]{7,40}, case-insensitive) andcommit_sha()to extract and lowercase valid hex SHAs before matchingheador callingis_main_ancestor(), plus the same check insideis_main_ancestor()as defense-in-depth.scripts/test_pr_check.py: cover non-hex refs, path traversal, query strings, leading-dash flags, out-of-range lengths, short/non-hex PR head commits, and valid 7–40 character lowercase/uppercase hex SHAs.Tested
python -I -m unittest discover -s scripts -p "test_*.py" -v: 12 passed, 0 failed (before the fix on47efa2e, all 3 new tests failed with 12 subtest failures)python -I scripts/pr_check.py --localagainstorigin/main(47efa2e):origin/main,refs/heads/main,HEAD~000, and--versionexit 1;47efa2eexits 0 (description ok)commit_sha()against the 25 most recently merged PRs onivall/xcl: 16 PRs withxcl-smokeblocks (32 blocks total), 0 rejected commits.\scripts\test.ps1 --skip test_title_runs_and_game_folder_is_untouched --skip test_title_draws_with_a_root_signature_under_the_debug_layer(on47efa2ewith this diff; touches no Rust): 739 passed, 0 failed, 41 ignored, 2 filtered outgpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)python -I scripts/pr_check.py --localon this PR's description and changed files:description okRegression run
scripts/pr_check.pyandscripts/test_pr_check.py(no runtime or build-input files).Not tested
pull_request_targetexecution (usesmain's copy ofscripts/pr_check.pyuntil merged)e2etests (test_title_runs_and_game_folder_is_untouched,test_title_draws_with_a_root_signature_under_the_debug_layer)AI use
scripts/pr_check.py, wrote the fix, unit tests, and this PR description, and ran the verification commands above.Mirror of xcl-dev#1141 (auto-synced, do not edit).