Caiyeon / goldfish

A HashiCorp Vault UI written with VueJS and Vault native Go API
https://vault-ui.io
Mozilla Public License 2.0
2.15k stars 166 forks source link

bug: JSON secrets are squished into strings #259

Closed stampycode closed 6 years ago

stampycode commented 6 years ago

Bug report:

Vault version: v0.9.3

Goldfish version: v0.9.0

Operating system: Linux

Steps to reproduce:

  1. PUT https://vault/v1/secret/test '{"something":["a","b","c"]}'
  2. in Goldfish, 'Edit Secret' for the above entry https://vault-ui/#/secrets?path=secret%2Ftest
  3. Goldfish converts the JSON object for "something" into a string "a,b,c".
  4. Edit the string (think maybe it will magically work): enter "a,b,c,d"
  5. Save
  6. Secret is now in Vault as a string "a,b,c,d" instead of JSON object ["a","b","c","d"] as intended.

Expected behaviour: Expected Goldfish to either prevent me from squishing my JSON object into a string, or to allow me to edit my JSON object.

Actual behaviour: Goldfish flattens my JSON object when I edit & save it.

This isn't a feature request per-se, Goldfish shouldn't be allowing me to deform my Vault secret without warning me that Goldfish will revert the object to a string.

philippescar commented 6 years ago

Same thing here, and this is forcing us to go back to the CLI for uploading JSON.

Caiyeon commented 6 years ago

Currently, every secret's value field is written as a string. Whether this should be classified as a bug or not is debatable, as text input fields should imply strings rather than magic.

Ideally I would like to change the secret writing process to be a json-centric text editor. #226 raised this concern first. As with basically every other feature I want to implement, I simply don't have time to do so. I will link this to the other issue and keep the existing one open for cleanliness. As always, pull requests are welcomed.