security: git tag create does not guard the tag name against a leading dash #710
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Reference
sixfold-space/madtea#710
Loading…
Add table
Add a link
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?
What happens
madtea tag createpasses the tag name intogit tagargv with no leading-dash guard. InrunTagCreate(internal/cmd/git/tag.go),name := args[0](:152) is appended togitArgsat:173, an optional commit ref (args[1]) at:177, then run viatagRunGit(ctx, gitArgs...)at:180. A name or commit ref beginning with-lands in option position and injects a flag intogit tag. The existence check at:156is safe (the name is prefixed withrefs/tags/); the sink is:173/:177.Scope
CLI surface (the value is the command's own argument), plus the
madt_enable-gatedtagsMCP domain. A tag name never legitimately begins with-, so the fix is non-breaking. Surfaced by the #708 HTTP-client sweep; the push path already guards its sibling ref.Fix (direction)
Reject a leading-dash
nameand commit ref before they reach argv (theValidateRefguard the push/fetch/rebase paths use), or place--before the positional arguments.Acceptance criteria
git tagnever receives a caller-controlled value in option position without a leading-dash guard or a--terminator.--prefixed tag name is refused.hexajon referenced this issue2026-10-05 12:34:16 +00:00