Use `--end-of-options` in the GitDSL
Requires the minimum version of Git 2.24: #2170 (closed)
From the GH release blog: https://github.blog/2019-11-03-highlights-from-git-2-24/#tidbits
Git 2.24 has a new way to prevent this sort of option injection attack using --end-of-options. When Git sees this as an argument to any command, it knows to treat the remaining arguments as such, and won’t interpret them as more options.
So, instead of the string previously mentioned, you could write the following to get the history of your (admittedly, pretty oddly named) branch:
$ git log --end-of-options --super-dangerous-option
Not using the standard -- was an intentional choice here, since this is already a widely-used mechanism in Git to separate reference names from files. In this example, you could have also written git log --end-of-options --super-dangerous-option ^master -- path/to/file to get only the history over that range which modified that specific file.
Example of the Git behaviour:
$ git diff --end-of-options --name-only HEAD~ HEAD
fatal: option '--name-only' must come before non-option arguments