GNU bug report logs - #1104
[emacs-w3m:10380] Re: pasting a password

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Tue, 7 Oct 2008 04:35:03 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1104 in the body.
You can then email your comments to 1104 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1104; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: jidanni <at> jidanni.org
To: bug-gnu-emacs <at> gnu.org
Cc: emacs-w3m <at> namazu.org
Subject: Re: [emacs-w3m:10380] Re: pasting a password
Date: Tue, 07 Oct 2008 12:26:47 +0800
Dear bug-gnu-emacs:
The challenge: attempt to paste this password into the w3m password
entry field.

>>>>> "DW" == Debian Wiki <debian-www <at> lists.debian.org> writes:

DW> Somebody has requested to submit your account data to this email address.
DW> If you lost your password, please use the data below and just enter the
DW> password AS SHOWN into the wiki's password form field (use copy and paste
DW> for that).

DW> After successfully logging in, it is of course a good idea to set a new and known password.

DW> Login Name: myname

DW> Login Password: {SHA}reallylongsodontaskmetotypeitinbyhandplease

DW> Login URL: http://wiki.debian.org/UserPreferences

The problem is C-y is just read as a raw character there at the
mini buffer Password: prompt. emacs-w3m-version "1.4.263".

>>>>> "KY" == Katsumi Yamaoka <yamaoka <at> jpl.org> writes:

KY> That's what `read-passwd' that is an Emacs function does.  In
KY> the function definition, the special keys that it handles are
KY> only C-h, C-u and C-? (see the doc string).

OK, sending to bug-gnu-emacs. emacs-version "22.2.1".





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1104; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 received at 1104 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: emacs-devel <at> gnu.org
Cc: 1104 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: pasting a password
Date: Sun, 16 Nov 2008 01:01:21 -0500
> DW> Login Name: myname
>
> DW> Login Password: {SHA}reallylongsodontaskmetotypeitinbyhandplease
>
> DW> Login URL: http://wiki.debian.org/UserPreferences
>
> The problem is C-y is just read as a raw character there at the
> mini buffer Password: prompt. emacs-w3m-version "1.4.263".
>
> KY> That's what `read-passwd' that is an Emacs function does.  In
> KY> the function definition, the special keys that it handles are
> KY> only C-h, C-u and C-? (see the doc string).

The following patch allows yanking into the password prompt (I haven't
changed the docstring of read-passwd, which needs doing).  What do
people think about the advisability of this?

Note, in particular, that we can detect any key that performs yank or
yank-pop by using `key-binding'---but it works only if the command is a
single-character key sequence.  That's fine for C-y, but fails if the
user has customized `yank' to a two-character sequence.  I don't see any
way around this, though.

Another shortcoming is that the user can no longer enter a literal C-y;
but this may be a negligble problem---currently, the user can't enter
C-u either, since C-u clears the field.


*** trunk/lisp/subr.el.~1.620.~	2008-11-06 01:49:41.000000000 -0500
--- trunk/lisp/subr.el	2008-11-16 00:48:31.000000000 -0500
***************
*** 1818,1838 ****
  		      (setq c (read-char-exclusive nil t))
  		      (and (/= c ?\r) (/= c ?\n) (/= c ?\e)))
  	  (clear-this-command-keys)
! 	  (if (= c ?\C-u)
! 	      (progn
! 		(and (arrayp pass) (clear-string pass))
! 		(setq pass ""))
! 	    (if (and (/= c ?\b) (/= c ?\177))
! 		(let* ((new-char (char-to-string c))
! 		       (new-pass (concat pass new-char)))
! 		  (and (arrayp pass) (clear-string pass))
! 		  (clear-string new-char)
! 		  (setq c ?\0)
! 		  (setq pass new-pass))
! 	      (if (> (length pass) 0)
! 		  (let ((new-pass (substring pass 0 -1)))
! 		    (and (arrayp pass) (clear-string pass))
! 		    (setq pass new-pass))))))
  	(message nil)
  	(or pass default "")))))
  
--- 1818,1845 ----
  		      (setq c (read-char-exclusive nil t))
  		      (and (/= c ?\r) (/= c ?\n) (/= c ?\e)))
  	  (clear-this-command-keys)
! 	  (cond ((= c ?\C-u)
! 		 (and (arrayp pass) (clear-string pass))
! 		 (setq pass ""))
! 		((memq (key-binding (vector c))
! 		       '(yank yank-pop))
! 		 (let ((new-pass (concat pass
! 					 (substring-no-properties
! 					  (current-kill 0)))))
! 		   (and (arrayp pass) (clear-string pass))
! 		   (setq c ?\0)
! 		   (setq pass new-pass)))
! 		((and (/= c ?\b) (/= c ?\177))
! 		 (let* ((new-char (char-to-string c))
! 			(new-pass (concat pass new-char)))
! 		   (and (arrayp pass) (clear-string pass))
! 		   (clear-string new-char)
! 		   (setq c ?\0)
! 		   (setq pass new-pass)))
! 		((> (length pass) 0)
! 		 (let ((new-pass (substring pass 0 -1)))
! 		   (and (arrayp pass) (clear-string pass))
! 		   (setq pass new-pass)))))
  	(message nil)
  	(or pass default "")))))
  

Diff finished.  Sun Nov 16 00:51:53 2008




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1104; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Andreas Schwab <schwab <at> suse.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #15 received at 1104 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: emacs-devel <at> gnu.org, 1104 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: pasting a password
Date: Sun, 16 Nov 2008 09:38:08 +0100
Chong Yidong <cyd <at> stupidchicken.com> writes:

> --- 1818,1845 ----
>   		      (setq c (read-char-exclusive nil t))
>   		      (and (/= c ?\r) (/= c ?\n) (/= c ?\e)))
>   	  (clear-this-command-keys)
> ! 	  (cond ((= c ?\C-u)
> ! 		 (and (arrayp pass) (clear-string pass))
> ! 		 (setq pass ""))
> ! 		((memq (key-binding (vector c))
> ! 		       '(yank yank-pop))

That does not work for yank-pop since the default binding is not a
single character one.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab <at> suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1104; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #20 received at 1104 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Andreas Schwab <schwab <at> suse.de>
Cc: emacs-devel <at> gnu.org, 1104 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: pasting a password
Date: Sun, 16 Nov 2008 11:08:02 -0500
Andreas Schwab <schwab <at> suse.de> writes:

> That does not work for yank-pop since the default binding is not a
> single character one.

Yeah.  Maybe we should just hardwire C-y to yank into the password
prompt, and leave it at that.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1104; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #25 received at 1104 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Andreas Schwab <schwab <at> suse.de>
Cc: Chong Yidong <cyd <at> stupidchicken.com>, 1104 <at> debbugs.gnu.org,
        jidanni <at> jidanni.org, emacs-devel <at> gnu.org
Subject: Re: pasting a password
Date: Sun, 16 Nov 2008 14:21:18 -0500
> That does not work for yank-pop since the default binding is not a
> single character one.

It's bound to a single-event sequence, namely M-y.  Now, it's true that
in several circumstances, M-y will be turned into ESC y, so it will only
work in some cases and not all (typically it'll work in a GUI but not
in a tty).
I think to do it better, we'll need to use an implementation technique
closer to the one used by isearch.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1104; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #30 received at 1104 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: jidanni <at> jidanni.org
To: monnier <at> iro.umontreal.ca
Cc: schwab <at> suse.de, cyd <at> stupidchicken.com, 1104 <at> debbugs.gnu.org,
        emacs-devel <at> gnu.org
Subject: Re: pasting a password
Date: Mon, 17 Nov 2008 04:55:58 +0800
Regarding those mile long one-time passwords that we are supposed to
paste into our browsers, etc.:

Some people also wish to paste the password into the box with the
mouse too (middle button). Therefore please roll back all that extra
security, and just do the plain echo asterisks, like firefox or
whatever.

Speaking about M-y. I am a old dog who still types ESC instead of
Meta-key for the M- stuff -- never learned new tricks.




Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to jidanni <at> jidanni.org:
bug acknowledged by developer. Full text and rfc822 format available.

Message #35 received at 1104-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: jidanni <at> jidanni.org
Cc: monnier <at> iro.umontreal.ca, schwab <at> suse.de,
        1104-done <at> debbugs.gnu.org, emacs-devel <at> gnu.org
Subject: Re: pasting a password
Date: Sun, 16 Nov 2008 16:07:42 -0500
jidanni <at> jidanni.org writes:

> Regarding those mile long one-time passwords that we are supposed to
> paste into our browsers, etc.:
>
> Some people also wish to paste the password into the box with the
> mouse too (middle button). Therefore please roll back all that extra
> security, and just do the plain echo asterisks, like firefox or
> whatever.
>
> Speaking about M-y. I am a old dog who still types ESC instead of
> Meta-key for the M- stuff -- never learned new tricks.

I added a C-y binding to read-passwd.  More complicated stuff, such as
allowing mouse pastes, will have to wait for a isearch-like rewrite of
read-passwd, as Stefan said.

(Also, we should probably document the keybindings that can be used to
enter passwords into the Emacs manual.  I'll add a new node for it.)




Message #36 received at 1104-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: jidanni <at> jidanni.org, schwab <at> suse.de, 1104-done <at> debbugs.gnu.org,
        emacs-devel <at> gnu.org
Subject: Re: pasting a password
Date: Sun, 16 Nov 2008 18:10:59 -0500
> I added a C-y binding to read-passwd.  More complicated stuff, such as
> allowing mouse pastes, will have to wait for a isearch-like rewrite of
> read-passwd, as Stefan said.

How 'bout using a completely different approach: setup a display-table
so that all chars get displayed as *, or else (so that the prompt can
be displayed properly) use an after-change-function to add a `display'
(or composition) property.
I.e. use normal editing, and only cause the display to use *.


        Stefan




Message #37 received at 1104-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: jidanni <at> jidanni.org, schwab <at> suse.de, 1104-done <at> debbugs.gnu.org,
        emacs-devel <at> gnu.org
Subject: Re: pasting a password
Date: Sun, 16 Nov 2008 18:37:19 -0500
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> How 'bout using a completely different approach: setup a display-table
> so that all chars get displayed as *, or else (so that the prompt can
> be displayed properly) use an after-change-function to add a `display'
> (or composition) property.  I.e. use normal editing, and only cause
> the display to use *.

That would allow you to copy the contents of the password prompt.  My
understanding is that most applications don't allow that (if you
accidentally leave the terminal without pressing enter, someone would be
able to copy what you've typed, paste it somewhere else, and view it in
cleartext).




bug archived. Request was from Debbugs Internal Request <don <at> donarmstrong.com> to internal_control <at> emacsbugs.donarmstrong.com. (Mon, 15 Dec 2008 15:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 247 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.