Skip to content

Commit

Permalink
X-Registry-Auth must be encoded to base64 url safe (#439)
Browse files Browse the repository at this point in the history
* X-Registry-Auth must be encoded to base64 url safe (aka alternate format in RFC 4648 in section 5)

* nit
  • Loading branch information
cfauchere authored Aug 26, 2021
1 parent a22e60a commit c9687e4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Docker.DotNet/Endpoints/ImageOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,13 @@ private Dictionary<string, string> RegistryAuthHeaders(AuthConfig authConfig)
{
{
RegistryAuthHeaderKey,
Convert.ToBase64String(Encoding.UTF8.GetBytes(this._client.JsonSerializer.SerializeObject(authConfig ?? new AuthConfig())))
Convert.ToBase64String(
Encoding.UTF8.GetBytes(
this._client.JsonSerializer.SerializeObject(authConfig ?? new AuthConfig())))
.Replace("/", "_").Replace("+", "-")
// This is not documented in Docker API but from source code (https://github.com/docker/docker-ce/blob/10e40bd1548f69354a803a15fde1b672cc024b91/components/cli/cli/command/registry.go#L47)
// and from multiple internet sources it has to be base64-url-safe.
// See RFC 4648 Section 5. Padding (=) needs to be kept.
}
};
}
Expand Down

0 comments on commit c9687e4

Please sign in to comment.