DockerCLI/cli-plugins/manager
Tibor Vass 48d30b5b32 Use golang.org/x/sys/execabs
On Windows, the os/exec.{Command,CommandContext,LookPath} functions
resolve command names that have neither path separators nor file extension
(e.g., "git") by first looking in the current working directory before
looking in the PATH environment variable.
Go maintainers intended to match cmd.exe's historical behavior.

However, this is pretty much never the intended behavior and as an abundance of precaution
this patch prevents that when executing commands.
Example of commands that docker.exe may execute: `git`, `docker-buildx` (or other cli plugin), `docker-credential-wincred`, `docker`.

Note that this was prompted by the [Go 1.15.7 security fixes](https://blog.golang.org/path-security), but unlike in `go.exe`,
the windows path lookups in docker are not in a code path allowing remote code execution, thus there is no security impact on docker.

Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 8d199d5bba)
Signed-off-by: Tibor Vass <tibor@docker.com>
2021-01-28 22:27:59 +00:00
..
candidate.go Use golang.org/x/sys/execabs 2021-01-28 22:27:59 +00:00
candidate_test.go Always enable experimental features 2020-10-02 15:59:42 +02:00
cobra.go Refactor plugins' vendor location on --help 2019-02-21 17:54:11 +01:00
error.go Update some uses of errors.Cause() to errors.Is() 2020-05-10 19:56:35 +02:00
error_test.go Update some uses of errors.Cause() to errors.Is() 2020-05-10 19:56:35 +02:00
manager.go Use golang.org/x/sys/execabs 2021-01-28 22:27:59 +00:00
manager_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-23 00:28:55 +01:00
manager_unix.go Add support for running a CLI plugin 2019-01-30 13:44:04 +00:00
manager_windows.go Search Windows CLI plugins also in ProgramFiles 2019-03-20 11:45:03 -07:00
metadata.go Always enable experimental features 2020-10-02 15:59:42 +02:00
plugin.go Always enable experimental features 2020-10-02 15:59:42 +02:00
suffix_unix.go Refactor code which deals with Windows' `.exe` suffix 2019-01-30 13:45:26 +00:00
suffix_windows.go Check for `.exe` case insensitively 2019-01-30 13:45:26 +00:00