mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:15:51 +01:00
[PR #2334] merge_check: guard ref option injection, bounds, and git timeouts #2338
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2338
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2334
Author: @kirigayakazima
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/merge-check-safety📝 Commits (1)
d6bb80dmerge_check: guard ref option injection, bounds, and git timeouts📊 Changes
2 files changed (+105 additions, -7 deletions)
View changed files
📝
scripts/merge_check.py(+40 -7)➕
tests/test_merge_check_safety.py(+65 -0)📄 Description
Claimed in the coordination issue as: MERGE-CHECK-OPTION-INJECTION-BOUNDS-AND-GIT-TIMEOUT (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7194083451)
What and why
_validate_ref()inscripts/merge_check.pyto reject empty, padded, or hyphen-prefixed git refs in--mainandPR=REF(blocking git CLI option injection such as12=--allor--main=--exec=...).parse_pair()(>= 1ASCII integer with at most one leading#, rejecting0=mainand##12=main) and add_positive_int(--depth >= 1) and_nonnegative_int(--min-length >= 0) bounds validators.GIT_TIMEOUT = 120ingit(), convertingsubprocess.TimeoutExpiredintoGitErrorso hung git invocations return clean exit code2with amerge_check:diagnostic.tests/test_merge_check_safety.py.Tested
python -I tests/test_merge_check_safety.py -v: 2 passed, 0 failed (detachedupstream/mainbaseline with only the new test file fails with 9 subtest failures and 1 error).python -I tests/test_merge_check.py -v: 24 passed, 0 failed.python -I tests/test_ci_registration.py: 16 passed.python -I tests/test_text_write_line_endings.py: 3 passed.python -I scripts/check_no_game_data.py,python -I -m compileall -q scripts/merge_check.py tests/test_merge_check_safety.py, andgit diff --cached --check: passed.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.