Skip to content

X-Registry-Auth header sent to Docker Engine API contains field "authHeader" #42905

@mhalbritter

Description

@mhalbritter

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"
}

Metadata

Metadata

Assignees

Labels

status: first-timers-onlyAn issue that can only be worked on by brand new contributorsstatus: supersededAn issue that has been superseded by anothertype: bugA general bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions