-
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
encrypting empty file panics #483
Comments
Thanks for reporting @jasonkuhrt! Seems to be yaml specific. |
Hi the issue seems to still exist... |
@ajvb , Is this issue planned to be fixed or somehow omitted? |
oh almost 3 seasons has passed and the bug is still there, looking forward to seeing it be fixed |
Also would like to ping on this. Shouldn't default behaviour be output=input in the case where there is nothing to encrypt? It would actually be nice to just run sops recursively on a repo full of manifests and have it look for things to encrypt and leave the rest alone. |
For this issue, I just make the yaml file have contents such as: placeholder: placeholder Not ideal but it's a pretty simple workaround. |
It seems that it has to be a valid yaml to be encrypted, so you can use |
I have come to this issue, it is true that it is very uncomfortable to handle these exceptions in automatic processes. I have broken files in this way:
|
I tried to fix this (#1290), but I'm not sure how the behavior should be. A simple way is to remove the crash (which checks that the first document doesn't have sops metadata - since there are zero documents in this file, it crashes). This results in an encrypted empty file being empty again. Decrypting that empty file isn't possible since it doesn't have sops metadata. Alternatively the YAML store could be changed to always return at least one document (tree branch in sops internal notation). That would result in a regular sops encrypted file, whose decryption would be So - should an empty file be treated as "zero YAML documents", or as "one YAML document that is an empty mapping"? |
According to the spec, an empty YAML file is zero YAML documents (see https://yaml.org/spec/1.2.2/#92-streams). |
This issue has been fixed by #1290, I just tested it with sops 3.8.1 and it seems to work. Shall we close this issue ? |
Redirecting the output to the file that is encrypted also causes this error. sops --encrypt some-file.yaml > some-file.yaml This results in |
@zoechi that's not very surprising, since Better use |
Closing since this is fixed. (Thanks @Ph0tonic!) |
¡Genial!
El sáb., 25 nov. 2023 21:45, Bastien Wermeille ***@***.***>
escribió:
… This issue has been fixed by #1290
<#1290>, I just tested it with sops
3.8.1 and it seems to work.
—
Reply to this email directly, view it on GitHub
<#483 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5N2CL6WZ7MYUDFZS6YBULYGJKFXAVCNFSM4HZFC7HKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBSGY2DCNRVGA2Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Not a great onboarding experience; in the following I try helm-secrets (which uses sops under the hood) but get a panic.
Maybe a more useful message would be
Nothing to encrypt
or just make encryption work but it be, well, empty string.The text was updated successfully, but these errors were encountered: