joker1007 / yaml_vault

Yaml file encryption/decryption helper.
MIT License
158 stars 20 forks source link

Can't encrypt if YAML contains alias with array #16

Closed mtsmfm closed 5 years ago

mtsmfm commented 5 years ago

I found this tool can't encrypt the following yaml with -k '$.a.c'

x: &x string
a:
  b:
    - *x
  c: hi

Demo

$ cat ok.yml
x: &x string
a:
  b:
    - x
  c: hi
$ bundle exec yaml_vault encrypt ok.yml -k '$.a.c' -o /dev/stdout
Enter passphrase:
encrypted ok.yml -> /dev/stdout
x: &x string
a:
  b:
  - x
  c: V3p3dlF1RXY2dkVlZ1V5U1UxbEhxUT09LS1ZZ2pHL0VrcnQranA0RWFoZjhPcnJ3PT0=--978ffaf2aa9739274734ea4ed9017d106b425f8532d23747c1262570bb8e29af
$ cat ng.yml
x: &x string
a:
  b:
    - *x
  c: hi
$ bundle exec yaml_vault encrypt ng.yml -k '$.a.c' -o /dev/stdout
Enter passphrase:
encrypted ng.yml -> /dev/stdout
x: &x string
a:
  b:
  - *x
  c: hi
joker1007 commented 5 years ago

Thank you for your reporting! and I'm sorry for late fixing.