You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: failure appears when try to decrypt yaml file with inline arrays followed with comments. Multiline arrays followed with comments are not affected.
Given a plain yaml file:
root:
- a: [ "one" ]
# comment
- b: three
- c:
- one
# comment
- d: three
Encrypt given file with sops -e plain.yaml > enc.yaml:
Decrypting enc.yaml results in warning message and partially decrypted original file (except one of the comments):
$ sops -d enc.yaml
[SOPS] WARN[0000] Found possibly unencrypted comment in file. This is to be expected if the file being decrypted was created with an older version of SOPS. comment="ENC[AES256_GCM,data:lLqrh4ddZeQ=,iv:L2zKeYMiQJfrXzOBI8+lJjWn1ML4HcjCmMiaEAgUlvk=,tag:MPvUtZ2XKzAyBqdAgVA81w==,type:comment]"
root:
- a:
- one
#ENC[AES256_GCM,data:lLqrh4ddZeQ=,iv:L2zKeYMiQJfrXzOBI8+lJjWn1ML4HcjCmMiaEAgUlvk=,tag:MPvUtZ2XKzAyBqdAgVA81w==,type:comment]
- b: three
- c:
- one
# comment
- d: three
The text was updated successfully, but these errors were encountered:
This unfortunately happens because SOPS moves your comment during the round-trip, and that breaks decryption since we use the 'path' of the item in the tree as the additional data for AES-GCM.
Basically, in your original document, SOPS believes your comment is under root, but on the encrypted document, it thinks the comment is under root > a.
It is sad to hear that this bag is hard to fix due to some internal reasons. Sometimes it is impossible to change the plain-text yaml file (e.g. when it is generated by 3rd-party software).
Worth it documenting this exceptional case in the Important information of types of the README.md alongside yaml anchors and yaml/json root array problems?
This might be fixed by #791, though probably only after re-encoding the file. yaml.v3 hopefully has less problems (once go-yaml/yaml#690 is fixed), and receives more fixes, at least over time.
OS: Ubuntu 20.04
Sops version: 3.6.1 (latest)
GnuPG version: 2.2.19
Libgcrypt version: 1.8.5
Description: failure appears when try to decrypt yaml file with inline arrays followed with comments. Multiline arrays followed with comments are not affected.
Given a plain yaml file:
Encrypt given file with
sops -e plain.yaml > enc.yaml
:Decrypting
enc.yaml
results in warning message and partially decrypted original file (except one of the comments):The text was updated successfully, but these errors were encountered: