Repository navigation
security: fix argument injection in pull request merge (rebase) - #8301
Merged
Merged
Conversation
|
Please can OP merge this?? |
pcastelovigo
approved these changes
Jun 1, 2026
Reject branch names starting with a hyphen in Merge() to prevent argument injection into git commands. A malicious branch name like '--exec=<cmd>' would be interpreted as a flag by git rebase, resulting in arbitrary command execution on the server. Additionally, add '--end-of-options' to the git rebase invocation as defense-in-depth, consistent with the existing use of '--end-of-options' in the git-module library (Clone, Push, Fetch, etc). Ref: GHSA-qf6p-p7ww-cwr9
unknwon
force-pushed
the
fix/merge-argument-injection
branch
from
June 6, 2026 02:30
46e1137 to
c66ec87
Compare
unknwon
added a commit
that referenced
this pull request
Jun 7, 2026
Co-authored-by: Jonah Burgess <[email protected]> Co-authored-by: Joe Chen <[email protected]> (cherry picked from commit a9dbafb)
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.
Branch names starting with
--(e.g.--exec=<cmd>) are passed unsanitized togit rebaseinMerge(), allowing argument injection. Sincegit rebase --execruns commands viash -c, this is an RCE for any user who can create a pull request with rebase merging enabled.This patch rejects branch names starting with
-at the top ofMerge(), and adds--end-of-optionsto thegit rebaseinvocation as defense-in-depth (consistent with how git-module v1.8.7 already handles Clone, Push, Fetch, etc).Ref: GHSA-qf6p-p7ww-cwr9