-
Notifications
You must be signed in to change notification settings - Fork 894
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
Comments
@MaikuMori What is the use case for piping? Why not just write the output to a file and then run |
I have a script which decodes content using Even doing something like Here are other issues which mention this as preferred way:
To make this even more useful sops should use config file when input is passed via Maybe also defaulting input/output type to binary unless specifically specified. |
Additionally on windows, running in cygwin. sops --decrypt --input-type yaml --output-type yaml --output /cygdrive/c/Users/RUNNER~1/AppData/Local/Temp/tmp.6bAckDpOVi/assets/values/sops/secrets.yaml.dec /cygdrive/c/Users/RUNNER~1/AppData/Local/Temp/tmp.6bAckDpOVi/assets/values/sops/secrets.yaml
# Error: cannot operate on non-existent file While sops --decrypt --input-type yaml --output-type yaml - < /cygdrive/c/Users/RUNNER~1/AppData/Local/Temp/tmp.6bAckDpOVi/assets/values/sops/secrets.yaml > /cygdrive/c/Users/RUNNER~1/AppData/Local/Temp/tmp.6bAckDpOVi/assets/values/sops/secrets.yaml.dec Would not. |
I'd like to add support for this feature. It prevents the necessity of unencrypted intermediate files that might potentially linger/be exposed on Windows. We are forced to work in a Windows environment, while the app is deployed to a Linux environment via CI/CD (also Linux based). We cannot use /dev/stdin and this request would provide a clean platform-independent way of reading via stdin. |
Just a quick comment for those who look a workaround, I used a temporary file with nanoseconds in the time to include the yaml content and remove it right after the sops execution. if [[ $OSTYPE == 'darwin'* ]]; then tempFile=./temp/${curTime} ENCRYPTED_CONTENT=$(echo "$CONTENT" > $tempFile | sops -e --encrypted-regex "$ENCRYPTED_REGEX" --input-type yaml --output-type yaml $tempFile) rm -f $tempFile |
If While the filename convention of using " |
One use case is never writing the unencrypted content to disk. Using this as a practise when working with secret files could reduce the risk of committing the secrets unencrypted as you're (supposedly) never having unencrypted secrets in your workspace to begin with. I really, really wish |
Getting this fixed is still on the roadmap; the original plan was to resurrect #1104 and fix the remaining issues with it, but so far nobody got around to actually do it. (I've added this issue to the roadmap, since having the closed PR on it isn't very helpful as a reminder...) |
I think we need to discuss how the interface should look like:
I'm currently tending to 2. Other opinions? CC @getsops/maintainers |
Is there any reason why |
Yes: Variant 3 would be the least amount of typing: |
I would also much prefer option 3. It is the default behaviour that I would expect for tools on the shell command line. |
Using a magic filename |
I've implemented variant 3 in #1690. |
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 fromstdin
.So something like
echo "asdf" | sops -
orecho "asdf" | sops -f -
Is this something you would accept a PR for?
The text was updated successfully, but these errors were encountered: