diff --git a/pkg/auth/auth.go b/pkg/auth/auth.go index f9b9b4368e..87c042496b 100644 --- a/pkg/auth/auth.go +++ b/pkg/auth/auth.go @@ -336,6 +336,9 @@ func parseMultiAuthHeader(authHeader string) (map[string]types.DockerAuthConfig, // Now convert to the internal types. authConfigs := make(map[string]types.DockerAuthConfig) + if len(dockerAuthConfigs) == 0 { + return nil, nil + } for server := range dockerAuthConfigs { authConfigs[server] = dockerAuthToImageAuth(dockerAuthConfigs[server]) } diff --git a/pkg/auth/auth_test.go b/pkg/auth/auth_test.go index 5a1c447e21..0edc38f4d7 100644 --- a/pkg/auth/auth_test.go +++ b/pkg/auth/auth_test.go @@ -392,6 +392,8 @@ func TestParseMultiAuthHeader(t *testing.T) { }{ // Empty header {input: "", expected: nil}, + // Empty JSON object {}=e30= base64-encoded + {input: "e30=", expected: nil}, // "null" {input: "null", expected: nil}, // Invalid JSON