Commit a5b751f
script/windows-installer: check Git program path
When installing and uninstalling Git LFS, the Git LFS
program configures its "clean" and "smudge" Git filters,
and to do this it executes Git so as to change the Git
global configuration (or, optionally, the system-wide,
local user, or worktree-specific configuration).
The Git program executed is the first one found using the
PATH environment variable (and, on Windows, the PATHEXT
environment variable).
Therefore, when installing Git LFS as an administrator with
elevated privileges, final responsibility lies with the
administrator to ensure there are no compromised executables
in their system PATH.
For instance, on Linux the "secure_path" configuration
value might be set in /etc/sudoers before running the command
"sudo git lfs install --system".
We can, however, attempt to assist the administrator on
Windows where we provide a dedicated installer and also
anticipate that Git will be installed under a common set
of directories.
For that reason we update our Inno Setup installer script so
that if it detects that the Git program found with the relevant
PATH and PATHEXT environment variables (either the user or
system ones, depending on the user's role) is not within
either of the "C:\Program Files" or "C:\Program Files (x86)"
directories, then a warning is displayed and the user prompted
to decide whether to continue.
And for convenience, we now report a failure message if no
Git program is found, which avoids subsequent errors during
the installation or uninstallation steps for any user.
Note, though, that if a Windows administrator runs the
"git-lfs.exe install" command manually, the checks we are
adding to the Inno Setup script will not be performed, and
the situation then is no different than a macOS or Linux
user running "sudo git-lfs install" without confidence that
the system PATH and installed Git binary are already secure.
Co-authored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>1 parent e06653d commit a5b751f
1 file changed
+63
-9
lines changedLines changed: 63 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
104 | 154 | | |
105 | 155 | | |
106 | 156 | | |
| |||
122 | 172 | | |
123 | 173 | | |
124 | 174 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
131 | 185 | | |
0 commit comments