pash icon indicating copy to clipboard operation
pash copied to clipboard

Add [e]dit command

Open krathalan opened this issue 5 years ago • 1 comments

This pull request adds an [e]dit command to pash, allowing easy editing of password files.

I understand your reluctance to use temporary files (leak in /proc?); however, I can't really think of a better way to do this apart from using the sread pass "Enter password" code from pw_add, but then editing multi-line password files becomes problematic/cumbersome/impossible.

A good solution would be to open a shell variable as a file in an editor, which works, but then saving the edited text back to the shell variable is what I can't figure out how to do.

Without this patch, I would assume the current solution to editing password files is to decrypt, edit, and re-encrypt manually, which is, at best, worst than this solution due to also having to manually delete the unencrypted password file. Additionally, /tmp is a tmpfs mount on many Linux distributions, which makes recovery of the unencrypted password file more difficult than editing it on a regular file system.

krathalan avatar Jun 30 '20 07:06 krathalan

If you don't like the usage of mktemp, it would be possible to mimic its behavior by generating a random string using tr and dd, like in pw_add.

krathalan avatar Jun 30 '20 07:06 krathalan