mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
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>
This commit is contained in:
committed by
GitHub
parent
79ab7059b0
commit
ed11c58ebf
@@ -56,6 +56,8 @@ func (m *mockProgram) Output() ([]byte, error) {
|
||||
return []byte(credentials.NewErrCredentialsNotFound().Error()), errProgramExited
|
||||
case invalidServerAddress:
|
||||
return []byte("program failed"), errProgramExited
|
||||
case "":
|
||||
return []byte(credentials.NewErrCredentialsMissingServerURL().Error()), errProgramExited
|
||||
}
|
||||
case "store":
|
||||
var c credentials.Credentials
|
||||
@@ -158,12 +160,16 @@ func TestGet(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
missingServerURLErr := credentials.NewErrCredentialsMissingServerURL()
|
||||
|
||||
invalid := []struct {
|
||||
serverURL string
|
||||
err string
|
||||
}{
|
||||
{missingCredsAddress, credentials.NewErrCredentialsNotFound().Error()},
|
||||
{invalidServerAddress, "error getting credentials - err: exited 1, out: `program failed`"},
|
||||
{"", fmt.Sprintf("error getting credentials - err: %s, out: `%s`",
|
||||
missingServerURLErr.Error(), missingServerURLErr.Error())},
|
||||
}
|
||||
|
||||
for _, v := range invalid {
|
||||
|
||||
Reference in New Issue
Block a user