aboutsummaryrefslogtreecommitdiffstats
path: root/git-gui/lib/shortcut.tcl
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2025-05-20 08:56:09 +0200
committerTaylor Blau <me@ttaylorr.com>2025-05-23 17:04:31 -0400
commit311d9ada3a7c2c49669d656a0359cc3a9ccfeeef (patch)
tree2a415d4e14344093eda9d6e2a0daa026ae564989 /git-gui/lib/shortcut.tcl
parentMerge branch 'ml/replace-auto-execok' (diff)
parentgit-gui: sanitize 'exec' arguments: convert new 'cygpath' calls (diff)
downloadgit-311d9ada3a7c2c49669d656a0359cc3a9ccfeeef.tar.gz
git-311d9ada3a7c2c49669d656a0359cc3a9ccfeeef.zip
Merge branch 'js/fix-open-exec'
This addresses CVE-2025-46835, Git GUI can create and overwrite a user's files: When a user clones an untrusted repository and is tricked into editing a file located in a maliciously named directory in the repository, then Git GUI can create and overwrite files for which the user has write permission. Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Diffstat (limited to 'git-gui/lib/shortcut.tcl')
-rw-r--r--git-gui/lib/shortcut.tcl12
1 files changed, 6 insertions, 6 deletions
diff --git a/git-gui/lib/shortcut.tcl b/git-gui/lib/shortcut.tcl
index 263f4899c9..1d01d9cbfa 100644
--- a/git-gui/lib/shortcut.tcl
+++ b/git-gui/lib/shortcut.tcl
@@ -30,8 +30,8 @@ proc do_cygwin_shortcut {} {
global argv0 _gitworktree oguilib
if {[catch {
- set desktop [exec cygpath \
- --desktop]
+ set desktop [safe_exec [list cygpath \
+ --desktop]]
}]} {
set desktop .
}
@@ -50,14 +50,14 @@ proc do_cygwin_shortcut {} {
"CHERE_INVOKING=1 \
source /etc/profile; \
git gui"}
- exec /bin/mkshortcut.exe \
+ safe_exec [list /bin/mkshortcut.exe \
--arguments $shargs \
--desc "git-gui on $repodir" \
--icon $oguilib/git-gui.ico \
--name $fn \
--show min \
--workingdir $repodir \
- /bin/sh.exe
+ /bin/sh.exe]
} err]} {
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
}
@@ -83,7 +83,7 @@ proc do_macosx_app {} {
file mkdir $MacOS
- set fd [open [file join $Contents Info.plist] w]
+ set fd [safe_open_file [file join $Contents Info.plist] w]
puts $fd {<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@@ -108,7 +108,7 @@ proc do_macosx_app {} {
</plist>}
close $fd
- set fd [open $exe w]
+ set fd [safe_open_file $exe w]
puts $fd "#!/bin/sh"
foreach name [lsort [array names env]] {
set value $env($name)