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

Once escaped quotes in ZARF_VAR value are not escaped when inserted into the values.yaml #2692

Open
JoeHCQ1 opened this issue Jul 3, 2024 · 1 comment

Comments

@JoeHCQ1
Copy link

JoeHCQ1 commented Jul 3, 2024

Environment

Device and OS: Sys76, PopOS laptop
App version: UDS 0.11.0, Zarf 0.34.0
Kubernetes distro being used: k3d
Other: Developing harbor UDS package

Steps to reproduce

  1. In a field where any character goes (like a 16 character random key), make it a ZARF_VAR
  2. Set that ZARF_VAR to have a value like this: "g\"Rg{067[R:#^_["` in the config yaml
  3. Render the values.yaml (assuming this causes an error, ctrl-c when Zarf starts to suffer, and the log file will still be there)
  4. Notice how that middle " got rendered such that it broke the YAML

Expected result

Quotes that are a value not a quote are escaped before being inserted in in-place of a ZARF_VAR.

Actual Result

The quote caused a YAML parser error because it was not escaped.

Visual Proof (screenshots, videos, text, etc)

Screenshot from 2024-07-02 21-40-58

Severity/Priority

Low

Additional Context

Obviously I can avoid this here by changing my dev-secret key. However, anywhere someone auto-generates their service-to-service secret keys this issue may re-appear.

@phillebaba
Copy link
Member

I would say this is a limitation of the variable templating. It does not consider YAML syntax when adding the variables. This puts the onus on the user to make sure that the end result will be valid YAML. I am not really sure how Zarf should solve this issue right now. If you want to solve the issue right now I would suggest switching to using single quotes around the string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Triage
Development

No branches or pull requests

2 participants