git-lfs/subprocess
brian m. carlson 74d5f2397f
subprocess: avoid using relative program names
When Go runs a program with os.exec, it uses the LookPath function to
look up the path name if the path does not contain a path separator.  On
Unix, this provides the standard Unix semantics by looking in PATH.
However, on Windows, it also looks in the current directory as well to
emulate the behavior of CMD.

Unfortunately, this is a well-known security flaw on Windows and similar
behavior there is the source for several whole classes of security
vulnerabilities.  This leads to an untrusted repository being able to
create a git.bat file that gets executed in preference to our trusted
path for the git binary.

Since we don't want to rely on Go fixing this behavior, let's import
some code from Go to provide the Unix semantics for LookPath, which are
secure if the user hasn't put the current directory in PATH.  That
should provide secure behavior in this case.  Fortunately, our code goes
through one particular place to run all commands, so this is a
relatively simple fix.

Update the various copyright and license files to reflect our imported
code.
2020-11-02 20:57:56 +00:00
..
buffered_cmd.go git: add git[NoLFS]Buffered() to run a Git processes with buffered output 2017-08-22 19:34:29 +02:00
cmd.go subprocess: trace all command execution 2020-07-01 12:13:29 -07:00
path_nix.go subprocess: avoid using relative program names 2020-11-02 20:57:56 +00:00
path_windows.go subprocess: avoid using relative program names 2020-11-02 20:57:56 +00:00
path.go subprocess: avoid using relative program names 2020-11-02 20:57:56 +00:00
subprocess_nix.go subprocess: avoid using relative program names 2020-11-02 20:57:56 +00:00
subprocess_test.go subprocess: add functions to format shell commands 2018-09-14 22:31:39 +00:00
subprocess_windows.go subprocess: avoid using relative program names 2020-11-02 20:57:56 +00:00
subprocess.go subprocess: don't initialize environment at startup 2020-10-14 16:49:23 +00:00