close
The Wayback Machine - https://web.archive.org/web/20201216023631/https://github.com/mozilla/sops/issues/739
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

Piping using `/dev/stdin` doesn't work on Windows #739

Open
MaikuMori opened this issue Sep 14, 2020 · 2 comments
Open

Piping using `/dev/stdin` doesn't work on Windows #739

MaikuMori opened this issue Sep 14, 2020 · 2 comments

Comments

@MaikuMori
Copy link

@MaikuMori MaikuMori commented Sep 14, 2020

The "workaround" to get piping to work is not cross-platform.

I highly recommend handling it like kubectl and other tools where you can pass in - as file name which triggers reading from stdin.

So something like echo "asdf" | sops - or echo "asdf" | sops -f -

Is this something you would accept a PR for?

@ajvb
Copy link
Member

@ajvb ajvb commented Sep 14, 2020

@MaikuMori What is the use case for piping? Why not just write the output to a file and then run sops -e -i <filename>?

@MaikuMori
Copy link
Author

@MaikuMori MaikuMori commented Sep 14, 2020

I have a script which decodes content using sops -d enc_file and reads stdout. Then it changes the content dynamically and needs to update the original encoded file. Currently, I work around this by creating a temp file, writing the content there then running sops on it and then overwrite the original file, then delete the temp file. It would be much nicer if sops could just read stdin.

Even doing something like cat asdf | base64 | sops --output asdf.enc -e - in terminal would be nice. (Alternatively cat asdf | base64 | sops -e - > asdf.enc)

Here are other issues which mention this as preferred way:

  • #510 (mentions -)
  • #696 (could be solved with -)
  • #330 (suggested alternative solution, but you can clearly see that /dev/stdin is not expected behavior. People expect piping to just work or work with -)

To make this even more useful sops should use config file when input is passed via stdin (tracked by #510). To decide which config to use we could use CWD or the directory of output file if specified.

Maybe also defaulting input/output type to binary unless specifically specified.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.