1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-13 16:01:28 +05:30
Commit Graph

15 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 129017a3cd credentials: define consts for supported actions (sub-commands)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-28 13:53:34 +02:00
Sebastiaan van Stijn 19557f8fff fix some errCheck warnings, and update examples
- Explicitly suppress some unhandled errors
- Use "pass" credentials helper in examples, which is available
  on more platforms than "secretservice" (only supporte on Linux)
- Update domain and username in examples.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-28 12:33:58 +02:00
Sebastiaan van Stijn 94483d2d23 godoc: credentials helper -> credentials-helper
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-28 12:13:49 +02:00
Sebastiaan van Stijn 4c9fc240ed client: use os/exec/Cmd.Environ() instead of os.Environ()
Don't set Env if not set; the default is already handled if it's nil; from
the documentation: https://pkg.go.dev/os/exec@go1.20.4#Cmd.Env

    // If Env is nil, the new process uses the current process's
    // environment.

Use `os/exec/Cmd.Environ()` instead of `os.Environ()`, which was added in
go1.19, and handles additional environment variables, such as `PWD` on POSIX
systems, and `SYSTEMROOT` on Windows. https://pkg.go.dev/os/exec@go1.20.4#Cmd.Environ

Also remove a redundant `fmt.Sprintf()`, as we're only concatenating strings.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-28 12:11:06 +02:00
Sebastiaan van Stijn c20f883316 client: don't use un-keyed literals in tests, and don't fail early
- don't fail tests early if there's more we can test
- don't user un-keyed literals in tests

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-27 17:14:13 +02:00
Sebastiaan van Stijn 37c4a6b158 remove uses of golang.org/x/sys/execabs
the "golang.org/x/sys/execabs" package was introduced to address a security
issue on Windows, and changing the default behavior of os/exec was considered
a breaking change. go1.19 applied the behavior that was previously implemented
in the execabs package;

from the release notes: https://go.dev/doc/go1.19#os-exec-path

> Command and LookPath no longer allow results from a PATH search to be found
> relative to the current directory. This removes a common source of security
> problems but may also break existing programs that depend on using, say,
> exec.Command("prog") to run a binary named prog (or, on Windows, prog.exe)
> in the current directory. See the os/exec package documentation for information
> about how best to update such programs.
>
> On Windows, Command and LookPath now respect the NoDefaultCurrentDirectoryInExePath
> environment variable, making it possible to disable the default implicit search
> of “.” in PATH lookups on Windows systems.

With those changes, we no longer need to use the execabs package, and we can
switch back to os/exec.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-26 02:11:17 +02:00
CrazyMax 9582eb6661 lint gha job
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-08-21 15:33:56 +02:00
Tibor Vass 431b64c703 Use golang.org/x/sys/execabs
Signed-off-by: Tibor Vass <tibor@docker.com>
2021-01-21 20:14:54 +00:00
Peter Hsu c69c0725bb A new entry point for calling the cred helpers that allow passing environment variables
Signed-off-by: Peter Hsu <shhsu@microsoft.com>
2017-06-30 10:45:22 -07:00
Nassim Eddequiouaq ed11c58ebf Prevent invalid credentials: no missing server URL or username (#62)
* Prevent invalid credentials: no missing server URL or username

Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>

* Add missing username/serverURL error checks in credstore client

Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>

* Clean up doc on invalid creds errors and client's error checks

Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>

* Add tests for missing ServerURL/Username

Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>

* Clean isValidCredsMessage prototype

Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>

* Add test for missing server URL and more detailed error msg

Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>
2017-05-29 10:21:50 +02:00
shhsu@microsoft.com 18d35e4984 Caller of cred helpers would now see the stderr returns from cred helpers
Signed-off-by: shhsu@microsoft.com <shhsu@microsoft.com>
2017-05-24 15:41:34 -07:00
Jake Sanders c45d9e9e28 Implement client.List, change list API
[]string, []string -> map[string]string because the other APIs assume a
1:1 correspondence

Signed-off-by: Jake Sanders <jsand@google.com>
2016-09-02 15:15:12 -07:00
avaid96 f1498a0524 go fmt is all osx files and general files
Signed-off-by: avaid96 <avaid1996@gmail.com>
2016-07-16 12:19:47 -07:00
avaid96 8fa18eb16c implementation on client side as well, complete with tests
Signed-off-by: avaid96 <avaid1996@gmail.com>
2016-07-13 10:20:51 -07:00
David Calavera c4fc9c07dd Add client functions to allow integrations within other CLIs.
This is a simplification of how the docker engine implements
this feature, but it will be ported there once this is merged.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-05-30 12:32:26 -07:00