-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Mask credentials from stderr for failed Docker logins for local mode #2180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @jmahlik , What would be the expected behavior on this? |
Currently it uses cmd = "docker login -u AWS -p %s %s" % (token, ecr_url)
subprocess.check_output(cmd.split()) To avoid the creds getting leaked, it should pass the password via stdin. Something like below should work. cmd = [
"docker",
"login",
ecr_url,
"-u",
"AWS"
"--password-stdin",
]
proc = subprocess.Popen(
cmd,
stdin=subprocess.PIPE,
)
stdout, stderr = proc.communicate(input=token.encode())
# I don't think the replacing below is necessary, since docker won't leak the creds with this login method
# But, just in case, possibly need to replace the token with * in the output
logger.info("%s, %s", stdout.decode().replace(token, "***"), stderr.decode().replace(token, "***")) |
Describe the bug
A clear and concise description of what the bug is.
Currently uses -p flag to pass credentials. This can result in creds being leaked. Change how docker login is handled or pipe the std err and raise manually on failure.
See conversation in #2146.
To reproduce
A clear, step-by-step set of instructions to reproduce the bug.
See PR, failed docker login = logs have leaked creds.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots or logs
If applicable, add screenshots or logs to help explain your problem.
System information
A description of your system. Please provide:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: