-
Notifications
You must be signed in to change notification settings - Fork 903
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
Version 3.7.0 and duplicated keys in a YAML file #851
Comments
3.7.0 uses a new YAML parser (see the changelog), that's why the behavior is different from 3.6.x or earlier. I'm a bit surprised that it is possible to encrypt a file with duplicate keys. I would expect it to fail with the same error. |
I've looked at this a bit. There are two parts:
In other words: when using yaml.v3 to deserialize (or serialize from) I'm not sure what's the best way to proceed here. We can add code to prevent to parse YAML files with duplicate keys in all cases (but we'd have to do that manually), or we can try to work around the issue with yaml.v3's Go struct deserialization to be able to handle YAML files with duplicate keys in all cases. |
I also found this error message in version Bdw, is there a new release/patch with fix? Thanks |
Got the error in 3.7.1. It's really problematic. Can't read the file anymore... |
How to recover from this? edit I just found out: |
Ignore message authentication code (mac) with |
This should get fixed by #1203. |
In contrast to Version 3.6.1,
in Version 3.7.0 on both Linux and Windows, when I encrypt a YAML file that accidentally has a duplicated key,
I cannot decrypt it afterwards.
Reproduce with
sops test.yaml
, duplicate the first line, and save.Then try to decrypt, and get:
The only way I found to recover the file would be to delete the offending key from the encrypted file
hello: ENC[AES256_GCM,data:nvp56OqVzo33WWLSyJubbsx4peUHNd/VQ3N4KXq2DRs4o5pf/3V3Hj8vg7DQUg==,iv:23E6rL8i155Ne1/SeGvsuc5OHku09sK9mhJv44Ky0gI=,tag:T0Dv5t+h3FMDYP7d2x01uw==,type:str]
and decrypt with
sops --ignore-mac test.yaml
The text was updated successfully, but these errors were encountered: