From e55d294ea7bce7fafafd037b63d5acf3e125ca4c Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 31 Jul 2025 15:41:33 +0200 Subject: [PATCH] api/types/registry: add TODO/note about empty authConfigs Signed-off-by: Sebastiaan van Stijn --- api/types/registry/authconfig.go | 5 +++++ api/types/registry/authconfig_test.go | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/api/types/registry/authconfig.go b/api/types/registry/authconfig.go index 73c30e9531..56703705a2 100644 --- a/api/types/registry/authconfig.go +++ b/api/types/registry/authconfig.go @@ -52,6 +52,11 @@ type AuthConfig struct { // // [RFC4648, section 5]: https://tools.ietf.org/html/rfc4648#section-5 func EncodeAuthConfig(authConfig AuthConfig) (string, error) { + // Older daemons (or registries) may not handle an empty string, + // which resulted in an "io.EOF" when unmarshaling or decoding. + // + // FIXME(thaJeztah): find exactly what code-paths are impacted by this. + // if authConfig == (AuthConfig{}) { return "", nil } buf, err := json.Marshal(authConfig) if err != nil { return "", errInvalidParameter{err} diff --git a/api/types/registry/authconfig_test.go b/api/types/registry/authconfig_test.go index 44cbbc8cb1..e69ca3d9e4 100644 --- a/api/types/registry/authconfig_test.go +++ b/api/types/registry/authconfig_test.go @@ -109,6 +109,10 @@ func TestEncodeAuthConfig(t *testing.T) { outPlain string }{ { + // Older daemons (or registries) may not handle an empty string, + // which resulted in an "io.EOF" when unmarshaling or decoding. + // + // FIXME(thaJeztah): find exactly what code-paths are impacted by this. doc: "empty", input: AuthConfig{}, outBase64: `e30=`,