DockerCLI/cli/config
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
..
configfile Config-file: remove User-Agent from config.json when saving 2020-10-01 15:04:39 +02:00
credentials Use golang.org/x/sys/execabs 2021-01-28 22:27:59 +00:00
types Remove docker api dependency from cli/config 2019-01-31 21:25:43 +00:00
config.go config: remove redundant os.Stat() 2020-06-15 11:08:56 +02:00
config_test.go Merge pull request #2599 from thaJeztah/ignore_empty_configfile 2020-07-09 15:27:29 +02:00