Skip to content

fix(security): deny abbreviated forms of denied git long options - #29

Merged
sonirico merged 1 commit into
masterfrom
security/git-long-option-abbreviations
Sep 4, 2026
Merged

fix(security): deny abbreviated forms of denied git long options#29
sonirico merged 1 commit into
masterfrom
security/git-long-option-abbreviations

Conversation

@sonirico

@sonirico sonirico commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Fixes GHSA-xvpv-9qcq-636h.

git's parse-options accepts any unambiguous prefix of a long option, so git blame --cont=/etc/passwd -- f bypassed the exact-match denylist for --contents. Same for --out, --ext, --open, --textc.

gitDeniedFlag now rejects any long flag that is a prefix of a denied option, ambiguous or not. Fails closed.

Local gate: go vet ./... && go test ./... green. Hosted CI is disabled on this account (billing), red checks are noise.

git's parse-options accepts any unambiguous prefix of a long option, so
`git blame --cont=/etc/passwd -- f` bypassed the exact-match denylist for
--contents (GHSA-xvpv-9qcq-636h). The same held for --out (--output),
--ext (--ext-diff), --open (--open-files-in-pager) and --textc
(--textconv). gitDeniedFlag now rejects any long flag that is a prefix of
a denied option, ambiguous or not, failing closed.
@sonirico
sonirico merged commit 743791c into master Sep 4, 2026
1 check passed
@sonirico
sonirico deleted the security/git-long-option-abbreviations branch September 4, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant