]> git.ipfire.org Git - thirdparty/git.git/commit
git-gui: sanitize 'exec' arguments: simple cases
authorJohannes Sixt <j6t@kdbg.org>
Mon, 21 Apr 2025 16:14:54 +0000 (18:14 +0200)
committerTaylor Blau <me@ttaylorr.com>
Fri, 23 May 2025 21:04:23 +0000 (17:04 -0400)
commit4f3e0a4bcef2c6caff68f96137d9914c5f2f98c2
treea2cd158ea1695e0af46853333677bf070ae3ed3c
parentc2e8904258544f3d79dc4e96d1269c0ad8124db3
git-gui: 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 that 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.

Note that most commands containing the word 'exec' route through
console::exec or console::chain, which we will treat in another commit.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
git-gui.sh
lib/diff.tcl
lib/shortcut.tcl
lib/win32.tcl