I am using mozilla/sops for encrypting and storing the secrets on git. They suggested a git diff filter to decrypt the data on git diff
and it shows the actual diff of secret instead of diff of cipher-text.
I configured this git filter using following commands.
git config diff.sopsdiffer.textconv "sops --decrypt --config /dev/null"
and adjusted .gitattributes
with *?.sops.yaml diff=sopsdiffer
attributes.
This basically means for abc.sops.yaml
file git diff will decrypt the file content and shows dif f of original secret.
Similarly, I want to use git grep
to decrypt and search in the decrypted content. However it does not work.
I used following commands to configure git grep filter.
git config grep.sopsgrepper.textconv "sops --decrypt --config /dev/null | grep -"
and adjusted .gitattributes
with *?.sops.yaml grep=sopsgrepper
attributes.
I then tested it with git grep "secret_value"
.
Any help/hint would be appreciable. Thanks