-
-
Notifications
You must be signed in to change notification settings - Fork 580
Closed
Description
Environment
- OS: Linux (nixos-unstable)
- age version: 1.1.1
What were you trying to do
Trying to encrypt a file in-place with age -p -o file file. I was trying to password-protect my age-secret-key,
which corrupted it irrevocably.
What happened
The resulting file is written while it is read, resulting in a data-race causing the newly written data to be used
in the current encryption. Due to the header overwriting the original data, the original content is lost. rage seems to be able to detect this and abort before doing any damage, and it would be great if age could also detect this.
# echo oops > test
# age -p -o test test
# cat test
age-encryption.org/v1
-> scrypt ukvhgUSL+2LmAzEKVMP4Bw 18
eyjc0VaSQN0oeFBqlTMRV9Tt4HLP25UpCCl1zgk5jT4
--- rqxebQUnlQ+DShsBKtxxfFvVm69wHaNdXX16Tm99eT8
<SMALL-AMOUNT-OF-BINARY>
# cat test | age -d
age-encryption.org/v1
-> scrypt ukvhgUSL+2LmAzEKVMP4Bw 18
eyjc0VaSQN0oeFBqlTMRV9Tt4HLP25UpCCl1zgk5jT4
--- rqxebQUnlQ+DShsBKtxxfFvVm69wHaNdXX16Tm99eT8
<LARGE-AMOUNT-OF-BINARY>
Metadata
Metadata
Assignees
Labels
No labels