From: Sebastian Wiesner <swiesner@lunaryorn.com>
To: Glenn Morris <rgm@gnu.org>
Cc: Andreas Schwab <schwab@suse.de>, 17839@debbugs.gnu.org
Subject: bug#17839: 24.4.50; read-passwd echoes password input in non-interactive sessions
Date: Wed, 25 Jun 2014 00:55:53 +0200 [thread overview]
Message-ID: <53FA2CB5-2009-4F77-B10D-03B16CE6D715@lunaryorn.com> (raw)
In-Reply-To: <mzlhsmi1zk.fsf@fencepost.gnu.org>
Am 24.06.2014 um 20:41 schrieb Glenn Morris <rgm@gnu.org>:
> Sebastian Wiesner wrote:
>
>>> Batch mode isn't designed for interaction. It uses standard I/O,
>>> oblivious to who is consuming the input.
>>
>> In this case `read-passwd' should at least signal an error when called
>> in non-interactive mode,
>
> I think that would be overkill.
I think that `read-passwd’ is a special case, because it *leaks a secret* when used in non-interactive mode, and the fact that it does is not immediately obvious. To learn this *in advance*, that is, before actually using this function in non-interactive code, one has to conclude from some rather abstract descriptions of Emacs’ behavior in the Emacs manual.
>> Currently it is simply insecure in non-interactive mode, and neither
>> its docstring nor the Emacs Lisp manual document that the password is
>> exposed when called in non-interactive mode.
>
> It's in the manual section on minibuffer input, and in batch mode there
> is no minibuffer. For example, read-file-name doesn't offer completion
> in batch-mode. It doesn't provide history. ctrl-k doesn't work. Etc.
> I see no point in mentioning these things in the doc-string of every
> function that uses the mini buffer.
There is a difference, I think. Completion, history, C-k, etc. are not crucial for entering a file name, but hiding input is absolutely crucial to entering a password securely. I can perfectly enter a file name without history or completion, but I cannot securely enter a password if it is shown during input.
So `read-file-name’ works in non-interactive mode, albeit less conveniently, but `read-passwd’ arguably does not.
Pointing out that non-interactive mode isn’t designed for interaction is right, probably, but misses the point imho.
Besides, “non-interactive” is a little vague. It’s obvious that `--batch’ is non-interactive, but is `--script’ as well? In other languages, e.g. Python or Perl, scripts regularly do interaction, including reading passwords.
I think it’s only natural that Emacs users will try to do the same in Emacs Lisp, encouraged by the existence of `--script’, so they’ll sooner or later hit this issue.
next prev parent reply other threads:[~2014-06-24 22:55 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-23 13:51 bug#17839: 24.4.50; read-passwd echoes password input in non-interactive sessions Sebastian Wiesner
2014-06-23 15:46 ` Andreas Schwab
2014-06-23 16:52 ` Sebastian Wiesner
2014-06-24 18:41 ` Glenn Morris
2014-06-24 22:55 ` Sebastian Wiesner [this message]
2014-06-25 7:47 ` Andreas Schwab
2014-06-25 8:01 ` Michael Albinus
2014-06-25 8:15 ` Andreas Schwab
2014-06-25 9:20 ` Michael Albinus
2014-06-25 9:26 ` Andreas Schwab
2014-06-25 10:03 ` Michael Albinus
2014-06-25 9:52 ` Sebastian Wiesner
2014-06-25 14:32 ` Stefan Monnier
2014-06-26 19:01 ` Glenn Morris
2014-07-10 14:36 ` Michael Albinus
2014-07-10 16:43 ` Stefan Monnier
2014-07-11 9:15 ` Michael Albinus
2014-07-11 9:41 ` Michael Albinus
2014-07-11 9:45 ` Eli Zaretskii
2014-07-11 9:58 ` Michael Albinus
2014-07-11 10:13 ` Eli Zaretskii
2014-07-11 11:32 ` Michael Albinus
2014-07-11 12:43 ` Michael Albinus
2014-07-11 14:02 ` Eli Zaretskii
2014-07-11 14:57 ` Michael Albinus
2014-07-11 15:46 ` Eli Zaretskii
2014-08-05 20:25 ` Sebastian Wiesner
2014-08-06 17:39 ` Stefan Monnier
2014-08-07 11:12 ` Sebastian Wiesner
2014-08-07 13:01 ` Stefan Monnier
2014-08-07 13:12 ` Sebastian Wiesner
2014-08-07 15:30 ` Eli Zaretskii
2014-08-07 16:08 ` Sebastian Wiesner
2014-08-07 16:38 ` Eli Zaretskii
2014-07-11 10:03 ` Eli Zaretskii
2014-07-11 10:15 ` Michael Albinus
2014-07-10 21:46 ` Sebastian Wiesner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53FA2CB5-2009-4F77-B10D-03B16CE6D715@lunaryorn.com \
--to=swiesner@lunaryorn.com \
--cc=17839@debbugs.gnu.org \
--cc=rgm@gnu.org \
--cc=schwab@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).