-
Notifications
You must be signed in to change notification settings - Fork 899
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
creation_rules from can't be matched when encrypting from stdin #594
Comments
You guessed right.
Sounds like you might want |
This looks more like a feature request than a bug. I'm not sure this is a feature we actually want, since your use case is something SOPS already provides out of the box. |
Hi @autrilla, thanks for pointing this out. I actually initially tried
yes, I guess this is a feature request, but I'd say that even though
but with given the project structure as described above I'm not able to do it and need to resort to a two step process which risks leaving unencrypted secrets lying around:
|
It would be nice if we could infer the path based on the
That could then respect the |
Hi friends, I think this might be a bug. I ran into this problem trying to run a build of a # example
ytt -f ./config -f ./overlays --data-values-file <(sops --decrypt values.enc.yaml) \
| sops --output ../k8s/ytt-build.enc.yaml --encrypt /dev/stdin This fails to match my creation_rules for yaml files. @autrilla the current
Shouldn't creation rules be matching on the path of the output file if possible? The input path is a good fallback choice, if the output is defaulting to stdout. That's one reason I used the Does anyone else agree this feels buggy? Would the project accept a patch to amend the path matching behavior to consider |
|
I use a workaround that works for me: some-command | EDITOR="cp -f /dev/stdin" sops secrets.yaml |
Thanks @simonfxr, nice hack! I’ve decided to abandon the use of .sops.yaml and instead use a wrapper around sops which decides which keys to use and passes it to sops as command line argument |
I agree that |
There's the case where the input is How about having a new parameter What do you think? Especially the new maintainers, @hiddeco @sabre1041 @onedr0p @devstein. If anyone has a better idea that also covers my use-case, I'm totally open for that as well :) (I'll also try to implement it.) |
I created #1332 to implement a |
Based on getsops/sops#594 (comment) and tested locally successful
🎉 |
given a project with following structure:
with
.sops.yaml
content:I am not able to encrypt data from stdin into the
secrets
directory, for examplegives me:
I am guessing that
sops
is trying to match/dev/stdin
against thecreation_rules
from the config file (changingpath_regex: secrets/.*
to path_regex: .*
makes it work, but that is obviously not a solution).Here's a sample repo which can be used to reproduce the error:
https://github.com/adrian-gierakowski/sops-encrypt-from-stdin
Possible solutions
The latter would be more universal as it would allow use cases where --output is not specified
As a side note: I stumbled upon this issue while trying to write a script to re-encrypt all files in a directory after changing the
creation_rules
, and wanted to avoid temporarily storing unencrypted data to disk while doing it.The text was updated successfully, but these errors were encountered: