Merge pull request #27458 from alessandro-verzicco/ignore-auth-json-empty

Fix authentication fallback when X-Registry-Auth header contains empty JSON object
This commit is contained in:
openshift-merge-bot[bot]
2025-11-06 21:27:16 +00:00
committed by GitHub
2 changed files with 5 additions and 0 deletions

View File

@@ -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])
}

View File

@@ -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