GitHubJacksonized

Reject abbreviated forms of muthaf*ckin' unsafe git options by Byron · Pull Request #2168 · gitpython-developers/GitPython

The prefix check could reject otherwise allowed one-letter short options when an unrelated blocked long option began with the same character. Keep exact matches for every spelling, but restrict prefix matching to explicit long options and multi-character kwargs.

This addresses the review comment: single-letter short options and kwargs must not be treated as long-option abbreviations. It also adds coverage for abbreviated unsafe kwargs so both clone validation paths remain protected.

Reviewd-by: Sebastian Thiel <[email protected]>
GitPython blocks options such as --upload-pack/-u and --config/-c
because they can execute arbitrary commands unless unsafe options are
explicitly allowed. Git also accepts a short option with its value
joined to the same token, including after clusterable flags. Forms
such as -uVALUE, -fuVALUE, -cVALUE, and -vcVALUE could therefore
bypass an exact-token check.

Parse single-dash option tokens sufficiently to recognize blocked
short options while preserving safe attached values such as
-oupstream. Also distinguish clone multi-option values from bare
kwargs so positional values are not treated as long-option
abbreviations.

This completes the option-validation hardening for
GHSA-2f96-g7mh-g2hx.

Reviewed-by: Sebastian Thiel <[email protected]>

Originally published at github.com. Every curse word you see was added by the Samuel L. Jacksonizer, a parody site. Not affiliated with Samuel L. Jackson or github.com.