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

fix: delete the 'runner_config_toml_rendereded' output variable #1019

Merged
merged 1 commit into from
Nov 10, 2023

Conversation

JulianCBC
Copy link
Contributor

@JulianCBC JulianCBC commented Oct 27, 2023

Description

Due to calls to nonsensitive in case the data is sensitive or not calling the function in the other case, the code gets very complex. The output variable runner_config_toml_rendereded was introduced for easier debugging, but we still have the option to write the whole Runner configuration to a local file (debug.write_runner_config_to_file).

This "fixers" that issue by just deleting the output variable.

Closes #1018

Migrations required

Usually not. For debugging purposes, set the debug.write_runner_config_to_file to true. The configuration is written to a file on your local disk (directory debug/)

Verification

Only linted as this is only deleting an output variable.

@github-actions
Copy link
Contributor

Hey @JulianCBC! 👋

Thank you for your contribution to the project. Please refer to the contribution rules for a quick overview of the process.

Make sure that this PR clearly explains:

  • the problem being solved
  • the best way a reviewer and you can test your changes

With submitting this PR you confirm that you hold the rights of the code added and agree that it will published under this LICENSE.

The following ChatOps commands are supported:

  • /help: notifies a maintainer to help you out

Simply add a comment with the command in the first line. If you need to pass more information, separate it with a blank line from the command.

This message was generated automatically. You are welcome to improve it.

@JulianCBC JulianCBC changed the title fix: Only nonsensitive() the user_data output if fleet is enabled fix: only nonsensitive() the user_data output if fleet is enabled Oct 27, 2023
@kayman-mk
Copy link
Collaborator

The fix is definitely needed. But the code looks rather complicated: var.runner_worker_docker_machine_fleet.enable == true ? nonsensitive(local.template_runner_config) : local.template_runner_config. It should simply return the template. But we have to wrap it with nonsensitive sometimes. I understand, why this is needed.

Maybe we find another solution to export the Runner's configuration? This was the original intend of this output variable. But I guess they will all have this sensitivity problem.

@JulianCBC
Copy link
Contributor Author

The fix is definitely needed. But the code looks rather complicated: var.runner_worker_docker_machine_fleet.enable == true ? nonsensitive(local.template_runner_config) : local.template_runner_config. It should simply return the template. But we have to wrap it with nonsensitive sometimes. I understand, why this is needed.

I completely agree: the goal of this pull request was to start the discussion and to that end I chose the "smallest" fix that wasn't completely insane or removing functionality. We definitely need a better solution than this.

Some options from my perspective:

  1. Just delete this output - it's not something people should need day-to-day unless they're either paranoid or debugging the module
  2. Only output something in this output if a flag is set - essentially turning it into a debug aid only
  3. Move the nonsensitive() call up into the inputs to the template, making that always non-sensitive - this would mean that the private key is effectively leaked into the state without any attempt to flag it as being private
  4. Pass the private key to the EC2 instance another way

@kayman-mk
Copy link
Collaborator

Voting for 2 and delete the output. The module writes the configuration to a local file. This should be sufficient for debugging.

Would be nice to get rid of sensitive/non sensitive. And I wouldn't consider this as a major change, as it is for debugging only.

This is saved to a file so users can view it there if needed.
@JulianCBC
Copy link
Contributor Author

Thanks @kayman-mk, I've re-done this pull request to just delete the output variable.

@JulianCBC JulianCBC changed the title fix: only nonsensitive() the user_data output if fleet is enabled fix: delete the 'runner_config_toml_rendereded' output variable Nov 10, 2023
@JulianCBC JulianCBC marked this pull request as ready for review November 10, 2023 01:13
@kayman-mk
Copy link
Collaborator

PR updated as we use it as commit message.

Copy link
Collaborator

@kayman-mk kayman-mk left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this bug.

@kayman-mk kayman-mk merged commit 3f7eaea into cattle-ops:main Nov 10, 2023
20 checks passed
kayman-mk pushed a commit that referenced this pull request Nov 11, 2023
🤖 I have created a release *beep* *boop*
---


##
[7.2.1](7.2.0...7.2.1)
(2023-11-10)


### Bug Fixes

* delete the 'runner_config_toml_rendereded' output variable
([#1019](#1019))
([3f7eaea](3f7eaea))
* run the GitLab Runner deregistration process at shutdown
([#1034](#1034))
([68884fd](68884fd))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Signed-off-by: Niek Palm <dev.npalm@gmail.com>
Co-authored-by: cattle-ops-releaser-2[bot] <134548870+cattle-ops-releaser-2[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@JulianCBC
Copy link
Contributor Author

Thanks @kayman-mk for your help in sorting this out and fixing up the PR message.

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.

"Error: Output refers to sensitive values" when applying fleet configuration
2 participants