[Question] Encrypt using the same data key
I am building a custom python wrapper over sops (called via subprocess), and i currently am following this approach
- Decrypt the file to stdout
- Convert that yaml content into a python dict
- Operate on the dict in memory
- Encrypt it and dump it back to the same file path
This works great and all but, it will always re-encrypt the entire file (and uses a different data key), which makes sense.
The reason why I'm doing it like this is because it's easier to operate on a dict rather than having to do type conversions, dump as json string, etc.
I am wondering, is there a reasonable way I could do this where sops would use the same data key to encrypt the context again before saving it to the final file path ?
Thank you
Right now there isn't a way (except by abusing sops edit with a custom SOPS_EDITOR command that basically writes the wanted content into the filename it is passed), but you aren't the first to ask for one: https://github.com/getsops/sops/issues/696