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 an optional boolean to not escape html during json encoding #890

Closed
WnP opened this issue Jan 29, 2024 · 1 comment · Fixed by #891
Closed

Add an optional boolean to not escape html during json encoding #890

WnP opened this issue Jan 29, 2024 · 1 comment · Fixed by #891
Labels
carvel accepted This issue should be considered for future work and that the triage process has been completed enhancement This issue is a feature request priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome.

Comments

@WnP
Copy link
Contributor

WnP commented Jan 29, 2024

By default the golang encode does escape problematic HTML characters inside JSON quoted strings. Which may leads to undesired behavior.

A typical example is when you are using the argocd-vault-plugin syntax inside a json string, which looks like this:

#@data/values
---
credentials:
  username: bob
  password: <path:/to/bob/password>

Then if I want to create a secret with

#@ load("@ytt:data", "data")
#@ load("@ytt:json", "json")
stringData: #@ json.encode(data.values.credentials, indent=2)

Then it compiles to:

stringData: |-
  {
    "username": "bob",
    "password": "\u003cpath:/to/bob/password\u003e"
  }

Which obviously isn't what we want.

It would be nice if we can call Encode.SetEscapeHTML somehow to prevent that.

@WnP WnP added carvel triage This issue has not yet been triaged for relevance enhancement This issue is a feature request labels Jan 29, 2024
@prembhaskal
Copy link
Contributor

@100mik this seems a valid ask, I think we should accept it.

@renuy renuy added carvel accepted This issue should be considered for future work and that the triage process has been completed priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome. and removed carvel triage This issue has not yet been triaged for relevance labels Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
carvel accepted This issue should be considered for future work and that the triage process has been completed enhancement This issue is a feature request priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants