-
Notifications
You must be signed in to change notification settings - Fork 893
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
Panic when encrypting yaml file with document separator followed by comment #300
Comments
The error is caused because of our YAML parser. Because of the internal representation of the YAML structure, a YAML document can only contain one structure at the top level (e.g. a YAML list, or a YAML map). Comments are then stored as nodes in the internal YAML parser representation (just like lists, maps, etc), so that means there can not be a comment and then a map at the top level. Please be aware that for this reason SOPS will not preserve comments on the top of the YAML file, even if this panic was fixed. The panic can definitely be fixed, but the comment is not going to be preserved any time soon as it'd require heavy modification to the parser. |
Thanks for the explanation! I've noticed that when sops encrypts the file, the top-level comment is lost and I'm glad to understand why.
That's totally fine for our purposes — we're wrapping sops in some tooling and want to present users an "annotated" example set of secrets. FWIW, this bug is not a blocker for us (we're simply drop the opening |
❤️ ❤️ ❤️ thanks, y'all! |
I've found a panic when encrypting a yaml document that begins with a document separator (i.e.
---
) followed by a comment.Demonstration
Interestingly, there is no panic if either the opening document separator or the opening comment is dropped:
(Output elided above to avoid leaking AWS account details.)
Details
3.0.0
on Linux and macOS and3.0.2
on macOSPlease let me know if I can provide any more info!
The text was updated successfully, but these errors were encountered: