diff --git a/pkg/collect/registry.go b/pkg/collect/registry.go index 178f7e7e..c343ab0e 100644 --- a/pkg/collect/registry.go +++ b/pkg/collect/registry.go @@ -221,7 +221,14 @@ func getImageAuthConfigFromData(imageRef types.ImageReference, pullSecrets *v1be // docker.io auth uses auth, e.g. auth: // username and password can't contain colon // at least according to https://github.com/docker/cli/blob/v27.0.3/cli/config/configfile/file.go#L247 - parts := strings.Split(string(auth.Auth), ":") + // fallback to not decode for compatibility + authStr := auth.Auth + decodedAuth, err := base64.StdEncoding.DecodeString(authStr) + if err == nil { + authStr = string(decodedAuth) + } + + parts := strings.Split(authStr, ":") if len(parts) != 2 { return nil, errors.Errorf("expected 2 parts in the auth string, but found %d", len(parts)) } diff --git a/pkg/collect/registry_test.go b/pkg/collect/registry_test.go index f20f51c7..94fb9f16 100644 --- a/pkg/collect/registry_test.go +++ b/pkg/collect/registry_test.go @@ -41,6 +41,14 @@ func TestGetImageAuthConfigFromData(t *testing.T) { expectedPassword: "sa-key", expectedError: false, }, + { + name: "proxy.replicated.com auth base64 encoded", + imageName: "proxy.replicated.com/app-slug/myimage", + dockerConfigJSON: `{"auths":{"proxy.replicated.com":{"auth":"bGljZW5zZV9pZF8xOmxpY2Vuc2VfaWRfMQ=="}}}`, + expectedUsername: "license_id_1", + expectedPassword: "license_id_1", + expectedError: false, + }, } for _, test := range tests {