-
Notifications
You must be signed in to change notification settings - Fork 3
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
Pass password via stdin, not an env var #81
Conversation
153c01a
to
68c6144
Compare
Thanks for the PR! My main hesitation with this is that it is a bit fragile, depending on the exact byte for byte message that restic prints when asking for a password via stdin. Would it not work to keep passing the password via env var but log the |
Then the password would still be readable to other processes of the same user. I'm hoping restic will move this issue, given that it's breaking the We can't really drop all lines that don't start with |
Good point about the other processes. There is also an additional problem where even if we are in redu plain password mode, the user may have one of the restic environment variables set and so restic would not even prompt for a password and we would fail to find the password prompt. |
The errors from restic should all be in stderr, right? So anything non-json in stdout must be the password prompt (at least for the particular restic commands we care about). This would stop being true if they do fix it and move the prompt to stderr. |
Well, at least this Warnings and errors seem to go to stderr. |
We could also lower the verbosity to 0? ( |
Another option could be |
This seems like a better option that gets around the other problem of the user independently setting env vars and having to parse password prompts. There is only the question of what to do on Windows. |
I am not not waiting for the prompt, just skipping the stray log line, if it is there. |
Maybe let's go back to your original idea of just writing to stdin but be a bit more flexible and ignore the first line of the output if it fails to parse as json. The idea being to not break redu if restic either changes the message or fixes this and moves the message to stderr. |
If we discard non-JSON lines anyway, Or we fix the logging of the password first, and change the password passing later. Anyway, you're the maintainer :) |
Yes, |
Fixes drdo#80 Contains a workaround for restic/restic#5236
68c6144
to
58ef7df
Compare
implementation is pushed |
Fixes #80
Contains a workaround for restic/restic#5236