Skip to content
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

updatekeys command should take --input-type option into account #1083

Closed
julianguinard opened this issue Jul 1, 2022 · 1 comment
Closed

Comments

@julianguinard
Copy link

julianguinard commented Jul 1, 2022

SOPS Version

SOPS v3.7.3, linux, amd64

Problem description

I have an encrypted test.sops.conf file that has been encrypted using the INI format

jguinard@laptop1515753:~/git/testg$ cat ~/tmp/test.sops.conf.ini|head -n 2
[default]
endpoint = ENC[AES256_GCM,data:iM+lmsnm,iv:7/S1Hay33u6Z23rUQJxeb6OicsB1a6DupKdnyR4BfEY=,tag:SMDEWIpz5TkywvmRGh9poA==,type:str]

If I try to update keys for it using the sops --input-type ini updatekeys command, the --input-type is ignored and I get the following error

jguinard@laptop1515753:~/git/testg$ sops --input-type ini updatekeys -y ~/tmp/test.sops.conf
2022/07/01 12:38:28 Syncing keys for file /home/jguinard/tmp/test.sops.conf
Error unmarshalling input json: invalid character 'd' looking for beginning of value

It seems that the command ignores the provided "ini" format and tries to handle the file as "binary"

By opposition, if I rename the file by adding the .ini extension to it and run the same command against it, the command will work

jguinard@laptop1515753:~/git/testg$ sops --input-type ini updatekeys -y ~/tmp/test.sops.conf.ini 
2022/07/01 12:38:38 Syncing keys for file /home/jguinard/tmp/test.sops.conf.ini
2022/07/01 12:38:38 File /home/jguinard/tmp/test.sops.conf.ini already up to date

Expected behavior

Using sops --input-type <format> updatekeys should take the --input-type format into account and handle the file in the specified format instead of trying to determine the format from its extension

@felixfontein
Copy link
Contributor

I implemented this in #1116.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants