Skip to content

Output of credential program need to be cleaned up before parsing as JSON #4064

@andreysaksonov

Description

@andreysaksonov

final JsonNode helperResponse = OBJECT_MAPPER.readTree(data);

Output of credential program might be prefixed with some warnings.

E.g. from my machine:

[2021-05-08 20:11:59,622] INFO  o.t.u.RegistryAuthLocator Failure when attempting to lookup auth config. Please ignore if you don't have images in an authenticated registry. Details: (dockerImageName: testcontainers/ryuk:0.3.1, configFile: /Users/saksonov/.docker/config.json. Falling back to docker-java default behaviour. Exception message: Unrecognized token 'time': was expecting 'null', 'true', 'false' or NaN
 at [Source: time="2021-05-08T20:11:59Z" level=error msg="failed to create file hook: unable to create a log file for docker-credential-desktop in directory /Users/saksonov/Library/Containers/com.docker.docker/Data/log/host: open /Users/saksonov/Library/Containers/com.docker.docker/Data/log/host/docker-credential-desktop.log: operation not permitted"
{"ServerURL":"index.docker.io","Username":"andreysaksonov","Secret":"ACTUAL_PASSWORD_DELETED"}; line: 1, column: 5]

And yes, it not only doesn't work properly but also discloses plain text password in the error message in the logs :(
I think if credential helper program exited with 0 exit status - RegistryAuthLocator must never print its output in any logs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions