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

Add a gitlab_runner_no_log_secrets option to prevent secret leaks #278

Merged
merged 2 commits into from
Sep 12, 2023

Conversation

loliee
Copy link
Contributor

@loliee loliee commented Aug 9, 2023

Goal

Ensure no secrets will leaks when running ansible.

Implementation

Add a new option that is not defined by default, adding this option will mute a lot of config tasks output.

⚠️ This setup is only done for unix runners, I don't have any windows machine to test

Test

  • add a S3 cache section with credentials
  • run ansible-playbook with -vvvv arg
  • look for credentials in output 👀 💥
  • define gitlab_runner_no_log_secrets: yes and run again
  • look for credentials in output 👀 ✅

Note

Thanks for your role it does exactly what I was looking for !
I just need this feature to use it for production purposes.

gitlab_runner_show_config_diff: no

# controls logs on ansible configuration tasks, uncomment to prevent secret leaks (Unix support only).
# gitlab_runner_no_log: yes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this name can be a little bit more specific because it doesn't turn off all logs but only a specific category...

Copy link
Contributor Author

@loliee loliee Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a lot of inspiration for this naming… What name would be acceptable for you?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just: gitlab_runner_no_log_secrets

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it has that logical name, no issues with merging it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for my answer delay.

So I pushed a fixup 14ef966 with the new naming: gitlab_runner_no_log_secrets.

However, the name still seems misleading to me because it obfuscates more than secrets.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@loliee If you are happy with the name (even if it is not 100% accurate but it gives a hint that more or less sensitive information is hidden with that flag), I'm happy to merge.

Copy link
Contributor Author

@loliee loliee Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most important for me is to hide secrets (and avoiding the use of an internal fork)!

So I squashed the fixup.

Thanks you @riemers @guenhter for merging this !

This setup is only supported on unix runners.
The default behavior doesn't changes anything, config outputs are
still there.
@loliee loliee changed the title Add a gitlab_runner_no_log option to prevent secret leaks Add a gitlab_runner_no_log_secrets option to prevent secret leaks Sep 12, 2023
@loliee
Copy link
Contributor Author

loliee commented Sep 12, 2023

The PR title and commit subject are also now reword with the new option name.

@guenhter guenhter merged commit c55eb7b into riemers:master Sep 12, 2023
@loliee loliee deleted the feat/no-log-setup-unix branch October 5, 2023 14:00
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 this pull request may close these issues.

None yet

3 participants