Skip to content

Conversation

@thaJeztah
Copy link
Member

relates to:

Commit cli@27b2797 forked the AuthConfig type from the API, and changed existing code to do a direct cast / convert of the forked type to the API type. This can cause issues if the API types diverges, such as the removal of the Email field.

This patch explicitly maps each field to the corresponding API type, but adds some TODOs, because various code-paths only included a subset of the fields, which may be intentional for fields that were meant to be handled on the daemon / registry-client only.

We should evaluate these conversions to make sure these fields should be sent from the client or not (and possibly even removed from the API type).

- What I did

- How I did it

- How to verify it

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2025

Codecov Report

❌ Patch coverage is 35.80247% with 52 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cli/command/registry/login.go 30.00% 20 Missing and 1 partial ⚠️
cli/command/image/build.go 0.00% 10 Missing and 1 partial ⚠️
cli/command/registry.go 66.66% 10 Missing ⚠️
cli/command/registry/search.go 0.00% 10 Missing ⚠️

📢 Thoughts on this report? Let us know!

@thaJeztah thaJeztah force-pushed the authconfig_no_direct_cast branch 3 times, most recently from 1049a08 to 32dae45 Compare September 29, 2025 10:32
Commit [cli@27b2797] forked the AuthConfig type from the API, and changed
existing code to do a direct cast / convert of the forked type to the API
type. This can cause issues if the API types diverges, such as the removal
of the Email field.

This patch explicitly maps each field to the corresponding API type, but
adds some TODOs, because various code-paths only included a subset of the
fields, which may be intentional for fields that were meant to be handled
on the daemon / registry-client only.

We should evaluate these conversions to make sure these fields should
be sent from the client or not (and possibly even removed from the API
type).

[cli@27b2797]: docker@27b2797

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Comment on lines -72 to -74
authCfg.ServerAddress = serverAddress
authCfg.IdentityToken = ""
return registrytypes.AuthConfig(authCfg), nil
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, we're resetting this field, but other places we either copy everything as-is, and in yet other places, we only include Username, Password, and ServerAddress - this needs some digging into. I suspect the AuthConfig struct as defined in the API contains fields that were meant to be used by the registry client, and some fields not intended to be accepted through the X-Registry-Auth header.

Comment on lines +85 to +90
ServerAddress: serverAddress,

// TODO(thaJeztah): Are these expected to be included?
Auth: authCfg.Auth,
IdentityToken: "",
RegistryToken: authCfg.RegistryToken,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More so, because the Auth field .. I think is the base64 encoded representation of Username:Password, so either the structured fields OR only the Username:Password should likely be sent.

@austinvazquez austinvazquez merged commit a61ecaf into docker:master Sep 29, 2025
88 of 89 checks passed
@thaJeztah thaJeztah deleted the authconfig_no_direct_cast branch September 30, 2025 07:25
@thaJeztah thaJeztah restored the authconfig_no_direct_cast branch September 30, 2025 07:27
@thaJeztah thaJeztah deleted the authconfig_no_direct_cast branch September 30, 2025 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants