]> git.ipfire.org Git - thirdparty/git.git/commit
gitk: sanitize 'exec' arguments: simple cases
authorJohannes Sixt <j6t@kdbg.org>
Mon, 17 Mar 2025 21:59:27 +0000 (22:59 +0100)
committerTaylor Blau <me@ttaylorr.com>
Fri, 23 May 2025 21:03:30 +0000 (17:03 -0400)
commit9f0d1c2f7d2543cd2549cbc26e142fd199f18b45
treebe649a2a386f1ba5b7c625b95e17830ec5080381
parent6eb797f5d1d8885c0f08e42cc5291c11be6f11a4
gitk: sanitize 'exec' arguments: simple cases

Tcl 'exec' assigns special meaning to its argument when they begin with
redirection, pipe or background operator. There are a number of
invocations of 'exec' which construct arguments that are taken from the
Git repository or a user input. However, when file names or ref names
are taken from the repository, it is possible to find names with have
these special forms. They must not be interpreted by 'exec' lest it
redirects input or output, or attempts to build a pipeline using a
command name controlled by the repository.

Introduce a helper function that identifies such arguments and prepends
"./" to force such a name to be regarded as a relative file name.

Convert those 'exec' calls where the arguments can simply be packed
into a list.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
gitk