Open
Description
Describe the bug
When GitHub Client authentication fails the private key can end up being printed in full plain text form in debug logs.
Splitting the private key string by new line can be dangerous, consider a simple mistake of putting the content of the PEM file in github_app_private_key
but with stripped new lines. We would end up with the entire key being printed in the debug logs.
Checks
- My actions-runner-controller version (v0.x.y) does support the feature
- I'm using an unreleased version of the controller I built from HEAD of the default branch
To Reproduce
Steps to reproduce the behavior:
- Create the controller-manager secret:
$ kubectl create secret generic controller-manager \
-n actions-runner-system \
--from-literal=github_app_id=app1337 \
--from-literal=github_app_installation_id=installation1338 \
--from-literal=github_app_private_key=THIS_IS_SECRET_NEVER_PRINT
- Use the above secret with actions-runner-controller and watch
THIS_IS_SECRET_NEVER_PRINT
being printed in the pod debug logs
Error: Client creation failed. authentication failed: using private key of size 26 (THIS_IS_SECRET_NEVER_PRINT...): could not parse private key: Invalid Key: Key must be PEM encoded PKCS1 or PKCS8 private key
Expected behavior
Never print the App private key to debug. The hash of the string should be printed, or the string should be replaced by *****
literal.
Environment (please complete the following information):
- Controller Version [0.21.1]
- Deployment Method [Helm ]
- Helm Chart Version [0.16.1]
Additional context
Add any other context about the problem here.