Skip to content
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

Docker Token Leaked in Debug Logs #485

Closed
therealdwright opened this issue Aug 1, 2023 · 8 comments · Fixed by #491
Closed

Docker Token Leaked in Debug Logs #485

therealdwright opened this issue Aug 1, 2023 · 8 comments · Fixed by #491

Comments

@therealdwright
Copy link
Contributor

Describe the bug
When setting the credentials as an output and running a github action in debug mode, the base64 encoded credentials are leaked in the logs.

To Reproduce
Steps to reproduce the behavior:

  1. Use action:
- name: Login to Amazon ECR Private
  id: login-ecr
  uses: aws-actions/amazon-ecr-login@v1
  1. Run job in debug mode
    Observe logs (obfuscated example below)
Screenshot 2023-08-01 at 10 10 58 am
  1. Login to ECR by doing the following:
    echo <TOKEN> docker login --username AWS --password-stdin <registry>

Expected behavior
The token to not be displayed in the logs.

Screenshots
See above.

@pascalgulikers
Copy link

pascalgulikers commented Aug 1, 2023

Also see: #483 (comment)
and
#464

@arjraman
Copy link
Contributor

arjraman commented Aug 1, 2023

As stated in #372, masking the credentials prevents them from being used in other jobs.

@therealdwright
Copy link
Contributor Author

As stated in #372, masking the credentials prevents them from being used in other jobs.

Your comment in #372 states:

If you look at PR #327, I reverted the change because the mask prevents the password from being used in other jobs. The docker password does not get outputted to logs unless they are specifically printed by the user.

This is not true, if you re-run a build in debug mode without any prints whatsoever, the credentials are printed in the logs. This is why I raised this issue.

@arjraman
Copy link
Contributor

arjraman commented Aug 2, 2023

@therealdwright My apologies, I should've made that more clear. When I say "specifically printed by the user", I'm inferring debug mode as well since it's documented as saying it will log environment information.

@therealdwright
Copy link
Contributor Author

since it's documented as saying it will log environment information.

This is quite undesirable behaviour as it's leaking sensitive credentials. Would you like me to have a go at pushing a PR to fix this?

@arjraman
Copy link
Contributor

arjraman commented Aug 2, 2023

Yeah we've had an internal discussion about this previously, but as of now we don't have anything planned soon to fix this. So a PR would be great, thanks! I'll take a look at it when I can.

@therealdwright
Copy link
Contributor Author

therealdwright commented Aug 3, 2023

Yeah we've had an internal discussion about this previously, but as of now we don't have anything planned soon to fix this. So a PR would be great, thanks! I'll take a look at it when I can.

I believe the original PR was the correct way to handle it as GitHub intentionally doesn't allow the passing of secret values between the job. Why must this behaviour be preserved when it knowingly leaks secrets?

If it is a hard and fast rule that docker_password must be an unmasked output I'd like to know so we can stop using this plugin.

@therealdwright
Copy link
Contributor Author

@arjraman - I decided a good compromise would be to add a mask-password input allowing users to optionally (disabled by default) mask the password. This seems to be a happy medium of allowing users to enforce password is not logged but maintains behaviour that your other users rely on.

@mergify mergify bot closed this as completed in #491 Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants