-
Notifications
You must be signed in to change notification settings - Fork 17
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
[Feature] rencrypt all files (only if the decrypted file changed) #135
Comments
@badele Heya! I have exactly this problem as well :-) The root cause of this is, I believe, because agebox uses an encryption mechanism (or at least, a mode of operating that mechanism) that doesn't produce repeatable, deterministic encryption. This is generally a good thing, as it defeats some known-plaintext attacks. But it has the downside that every time a file's contents is re-encrypted, the cypher text changes - and because git sees the file as binary, it treats it as 100% modified. The I figure that because @slok has given us #143, it's now viable to write a script that:
Ok, this is a bit hacky! It sticks a bunch of things together, and could probably use some refinement :-) But I think that it's at least viable, and by writing it we'll probably come up with some feature requests for @slok, if there're ways to make the Developer Experience nicer :-) |
Thanks @jpluscplusm for your response, i think another solution can be developped When i use I think this feature can be develop easyly ? (sorry, i not a go developer) |
I wrote quick small script to achieve this. (not sure I did it right way)
|
Maybe agebox should not delete the original encrypted |
@Threnklyn I think there are a couple of nuances to work through, conceptually:
|
We don't need to store the hash of the plain file in git. Save it temporarily after decryption until the file is encrypted again. You are absolutely right regarding saving the hash in git |
Just came across this discussion before trying out the tool. The non-deterministic nature of age encryption is the main reason I started looking for tools that can solve this issue conveniently in order to commit encrypted files in repos, but it looks like this is not tackled here. |
I use this workflow (i use a command from my Makefile (see bellow) )
make secret-unlock
make secret-lock secret-check
But If the decrypted files not changed and if i use
make secret-lock
the content of encrypted files has changed, is it possible to store de SHA1 in the encrypted file (or tempory hidden file during decryption step) and reencrypt only if SHA1 changed and restore encrypted file git state if SHA1 is identicalThe text was updated successfully, but these errors were encountered: