git's –end-of-options Flag
a day ago
- Git's --end-of-options flag, introduced in 2019, marks the end of option parsing for revisions, distinct from -- which separates revisions from pathspecs.
- Argument injection (CWE-88) occurs when untrusted strings starting with a dash are passed as arguments to git, hg, or ssh, even without a shell involved.
- Only one of 17 package managers that fork git uses --end-of-options; others rely on -- or dash checks, often added as vulnerability fixes.
- Minimum git version requirements for --end-of-options vary by subcommand, with support ranging from 2.24.0 to 2.43.1, making adoption challenging for older distributions.
- Git libraries like libgit2 avoid argument injection by not using an argv interface, but must track all checkout-safety patches from upstream git.