]> git.ipfire.org Git - thirdparty/git.git/commit
gitk: sanitize 'open' arguments: simple commands
authorJohannes Sixt <j6t@kdbg.org>
Thu, 20 Mar 2025 18:32:56 +0000 (19:32 +0100)
committerTaylor Blau <me@ttaylorr.com>
Fri, 23 May 2025 21:03:30 +0000 (17:03 -0400)
commitfe32bf31b8d5dff523543700ab76ecbf423a6d6f
tree4e565ae4fa9447c602cd78063d7f1cd7308b4975
parent30846b43060c3d57575b59b9aaa80c4bd1688171
gitk: sanitize 'open' arguments: simple commands

Tcl 'open' treats the second argument as a command when it begins
with |. The remainder of the argument is a list comprising the command
and its arguments. It assigns special meaning to these arguments when
they begin with a redirection, pipe or background operator. There are a
number of invocations of 'open' 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 which have these special forms. They must not be interpreted by
'open' 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.

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