-
Notifications
You must be signed in to change notification settings - Fork 912
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
SOPS panics when input type is not binary but output type is and input contains a 'data' mapping key. #596
Comments
I think your issue is that while you've specified an --input-type, you haven't specified an --output-type. So SOPS is loading the file as YAML (as you told it to), but then tries to emit it as binary. Usually this isn't a problem, but unfortunately your YAML has a top-level 'data' key, which is the key that SOPS uses to stuff binary data into. Panicking definitely isn't the right thing to do here, though :). In general, outputting as binary when the input is not binary should probably be disallowed. |
Hi Adrian,
Yes, specifying *--input-type *and leaving *out --output-type *is a
precondition for the crash. I understand now after your explanation what
has happened. From the user perspective, I'd suggest, that if output type
is not specified, it shall default to input-type (e.g. yaml in, yaml out).
User do not expect format conversion, it is save to assume that output
format is the same as input, if not otherwise specified. I missed out
output-type not by mistake, I thought that SOPS it is not needed for normal
operations. The crash surprised me and I didn't connected to missed output
format specification at the first place.
Hope this input helps to improve wonderful tool further.
Thank you for your work and Happy New Year,
Anton
…On Thu, 26 Dec 2019 at 15:18, Adrian Utrilla ***@***.***> wrote:
I think your issue is that while you've specified an --input-type, you
haven't specified an --output-type. So SOPS is loading the file as YAML (as
you told it to), but then tries to emit it as binary. Usually this isn't a
problem, but unfortunately your YAML has a top-level 'data' key, which is
the key that SOPS uses to stuff binary data into.
Panicking definitely isn't the right thing to do here, though :). In
general, outputting as binary when the input is not binary should probably
be disallowed.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#596>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEECBZFQR55WAQVU3RL4GH3Q2S4NDANCNFSM4J4SZBQQ>
.
|
I came across this exact same issue with Also, I second @0anton's point of view in that by default, SOPS should use the input type for output as well, since this is what most users would want I reckon. But I think that if this isn't agreed upon and if SOPS was to maintain the current approach, it should probably mention it in the README (for example when the How do the collaborators feel about the "default output type being the same as the input type"? Because if this isn't going to change anytime soon, this is a very slight change to a README that I could propose in a tiny PR, just to help future users :) I really enjoy using this tool, and thank you all for your hard work! P.S.: just fun to see that this answer is almost exactly 2 years after your previous Happy New Year wishes @0anton 😄 ⛄ |
This would be a breaking change. There probably are many uses already which only work because of the current behavior, and will break once it is changed. For example, think of someone who wants sops encrypted data to always use YAML, even for binary file. They do |
I've implemented better error handling including a |
Sops (latest version) panics, when decrypting yaml file with explicit type specification. Same file with .yaml extension is decrypted successfully.
The text was updated successfully, but these errors were encountered: