Skip to content
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

UX: Empty files created upon passphrase mismatch #159

Closed
jynik opened this issue Nov 29, 2020 · 0 comments
Closed

UX: Empty files created upon passphrase mismatch #159

jynik opened this issue Nov 29, 2020 · 0 comments
Milestone

Comments

@jynik
Copy link

jynik commented Nov 29, 2020

What were you trying to do

Create an encrypted file using a symmetric key.

What happened

When a passphrase is entered incorrectly, an empty output file is created.
My expectation was that no file would be created until after the program has performed the encryption operation.

$ echo "Hello World" > test.txt
$ age -p -o test.txt.age test.txt
Enter passphrase (leave empty to autogenerate a secure one):  Test
Confirm passphrase: test
Error: passphrases didn't match
[ Did age not do what you expected? Could an error be more useful? Tell us: https://filippo.io/age/report ]
$ ls -l
-rw-r--r-- 1 user user   12 Nov 29 13:31 test.txt
-rw-r--r-- 1 user user    0 Nov 29 13:32 test.txt.age
FiloSottile added a commit that referenced this issue Jan 2, 2021
This avoids leaving behind an empty file when an error occurs before we
write the header (for example, because the passphrase is invalid). Do a
best-effort check before taking user input for whether the file exists
so we don't waste user effort. An error might still happen after user
input if other kind of open errors happen (for example, a permission
issue, or disk full).

Fixes #159
Fixes #57
Closes #169
FiloSottile added a commit that referenced this issue Jan 3, 2021
This avoids leaving behind an empty file when an error occurs before we
write the header (for example, because the passphrase is invalid). Do a
best-effort check before taking user input for whether the file exists
so we don't waste user effort. An error might still happen after user
input if other kind of open errors happen (for example, a permission
issue, or disk full).

Fixes #159
Fixes #57
Closes #169
@FiloSottile FiloSottile added this to the v1.0.0 milestone Apr 22, 2021
FiloSottile added a commit that referenced this issue Jun 16, 2024
FiloSottile added a commit that referenced this issue Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants