-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Description
When constructing the header value for X-Registry-Auth
when talking to the Docker Engine API, org.springframework.boot.buildpack.platform.docker.configuration.JsonEncodedDockerRegistryAuthentication#getAuthHeader
is called. This getter is backed by the field authHeader
, which is filled from org.springframework.boot.buildpack.platform.docker.configuration.JsonEncodedDockerRegistryAuthentication#createAuthHeader
.
This uses SharedObjectMapper.get().writeValueAsBytes(this)
. However, the JSON from that serialization not only includes the necessary fields like username
and password
, but also the field authHeader
, which is only used for caching the constructed header.
We should annotate the authHeader
field with @JsonIgnore
and verify in the tests (DockerRegistryUserAuthenticationTests
and DockerRegistryTokenAuthenticationTests
) that the header doesn't contain the authHeader
field in the JSON.
What it looks like:
{
"authHeader" : null,
"username" : "user",
"password" : "secret",
"email" : "[email protected]",
"serveraddress" : "https://docker.example.com"
}
What it should look like (note the removed authHeader
field):
{
"username" : "user",
"password" : "secret",
"email" : "[email protected]",
"serveraddress" : "https://docker.example.com"
}