GNU bug report logs -
#17127
`call-process' circumvents password concealment w/ `read-passwd'
Previous Next
Reported by: Nathan Trapuzzano <nbtrap <at> nbtrap.com>
Date: Fri, 28 Mar 2014 00:34:01 UTC
Severity: normal
Tags: fixed
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
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 17127 in the body.
You can then email your comments to 17127 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17127
; Package
emacs
.
(Fri, 28 Mar 2014 00:34:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Nathan Trapuzzano <nbtrap <at> nbtrap.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 28 Mar 2014 00:34:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
To reproduce with emacs -nw -q on 24.3 and trunk:
M-: (global-set-key
(kbd "C-c C-c")
(lambda ()
(interactive)
(call-process "echo" nil t nil "-n" "foobar")))
M-: (read-passwd "Password: ")
C-c C-c
"foobar" is printed in the minibuffer rather than "......", whereas,
e.g., yanking from the kill ring print dots.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17127
; Package
emacs
.
(Fri, 28 Mar 2014 02:05:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 17127 <at> debbugs.gnu.org (full text, mbox):
> To reproduce with emacs -nw -q on 24.3 and trunk:
> M-: (global-set-key
> (kbd "C-c C-c")
> (lambda ()
> (interactive)
> (call-process "echo" nil t nil "-n" "foobar")))
> M-: (read-passwd "Password: ")
> C-c C-c
This looks fairly contrived. How did you stumble upon this problem?
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17127
; Package
emacs
.
(Fri, 28 Mar 2014 02:40:03 GMT)
Full text and
rfc822 format available.
Message #11 received at 17127 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:
> This looks fairly contrived. How did you stumble upon this problem?
Copy/pasting passwords from console password manager to emacs running on
terminal emulator in X. The built-in copy/paste functionaly for the X
clipboard only works (AFAIK) with graphical emacs, so I use my own
commands to make it work on a terminal. Here's the one that made me
catch it:
(defun paste-from-X-clipboard ()
"Insert the X clipboard contents at point."
(interactive)
(call-process "xclip" nil t nil "-selection" "clipboard" "-o"))
I use that to paste passwords when, e.g., finding remote files via
ssh/TRAMP.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17127
; Package
emacs
.
(Sun, 29 Sep 2019 14:36:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 17127 <at> debbugs.gnu.org (full text, mbox):
Nathan Trapuzzano <nbtrap <at> nbtrap.com> writes:
> To reproduce with emacs -nw -q on 24.3 and trunk:
>
> M-: (global-set-key
> (kbd "C-c C-c")
> (lambda ()
> (interactive)
> (call-process "echo" nil t nil "-n" "foobar")))
>
> M-: (read-passwd "Password: ")
>
> C-c C-c
>
> "foobar" is printed in the minibuffer rather than "......", whereas,
> e.g., yanking from the kill ring print dots.
The following patch fixes this, I think, by using post-command-hook
instead of after-change-functions.
It seems to work for me -- does anybody see a problem with doing it this
way?
diff --git a/lisp/subr.el b/lisp/subr.el
index 45b99a82d2..9e4553dcbb 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2426,6 +2426,12 @@ read-passwd-map
map)
"Keymap used while reading passwords.")
+(defun read-password--hide-password ()
+ (let ((beg (minibuffer-prompt-end)))
+ (dotimes (i (1+ (- (buffer-size) beg)))
+ (put-text-property (+ i beg) (+ 1 i beg)
+ 'display (string (or read-hide-char ?*))))))
+
(defun read-passwd (prompt &optional confirm default)
"Read a password, prompting with PROMPT, and return it.
If optional CONFIRM is non-nil, read the password twice to make sure.
@@ -2450,15 +2456,7 @@ read-passwd
(message "Password not repeated accurately; please start over")
(sit-for 1))))
success)
- (let ((hide-chars-fun
- (lambda (beg end _len)
- (clear-this-command-keys)
- (setq beg (min end (max (minibuffer-prompt-end)
- beg)))
- (dotimes (i (- end beg))
- (put-text-property (+ i beg) (+ 1 i beg)
- 'display (string (or read-hide-char ?*))))))
- minibuf)
+ (let (minibuf)
(minibuffer-with-setup-hook
(lambda ()
(setq minibuf (current-buffer))
@@ -2469,7 +2467,7 @@ read-passwd
(use-local-map read-passwd-map)
(setq-local inhibit-modification-hooks nil) ;bug#15501.
(setq-local show-paren-mode nil) ;bug#16091.
- (add-hook 'after-change-functions hide-chars-fun nil 'local))
+ (add-hook 'post-command-hook 'read-password--hide-password nil t))
(unwind-protect
(let ((enable-recursive-minibuffers t)
(read-hide-char (or read-hide-char ?*)))
@@ -2479,7 +2477,8 @@ read-passwd
;; Not sure why but it seems that there might be cases where the
;; minibuffer is not always properly reset later on, so undo
;; whatever we've done here (bug#11392).
- (remove-hook 'after-change-functions hide-chars-fun 'local)
+ (remove-hook 'after-change-functions 'read-password--hide-password
+ 'local)
(kill-local-variable 'post-self-insert-hook)
;; And of course, don't keep the sensitive data around.
(erase-buffer))))))))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17127
; Package
emacs
.
(Sun, 13 Oct 2019 03:17:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 17127 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>> "foobar" is printed in the minibuffer rather than "......", whereas,
>> e.g., yanking from the kill ring print dots.
>
> The following patch fixes this, I think, by using post-command-hook
> instead of after-change-functions.
>
> It seems to work for me -- does anybody see a problem with doing it this
> way?
There were no comments in two weeks, so I've now applied the patch.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 13 Oct 2019 03:17:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 27.1, send any further explanations to
17127 <at> debbugs.gnu.org and Nathan Trapuzzano <nbtrap <at> nbtrap.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 13 Oct 2019 03:17:03 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17127
; Package
emacs
.
(Wed, 23 Oct 2019 22:03:02 GMT)
Full text and
rfc822 format available.
Message #24 received at 17127 <at> debbugs.gnu.org (full text, mbox):
> The following patch fixes this, I think, by using post-command-hook
> instead of after-change-functions.
Actually, in theory after-change-functions should catch all cases
whereas post-command-hook might miss some (i.e. chars inserted not
while running a command, e.g. from a process filter).
So while your new code probably works fine in practice (and is a good
workaround for now) , I think the original code is "more correct" and we
should try and figure out why it didn't work: how come
after-change-functions is not run (or not correctly) by call-process?
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17127
; Package
emacs
.
(Thu, 24 Oct 2019 11:50:02 GMT)
Full text and
rfc822 format available.
Message #27 received at 17127 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> The following patch fixes this, I think, by using post-command-hook
>> instead of after-change-functions.
>
> Actually, in theory after-change-functions should catch all cases
> whereas post-command-hook might miss some (i.e. chars inserted not
> while running a command, e.g. from a process filter).
>
> So while your new code probably works fine in practice (and is a good
> workaround for now) , I think the original code is "more correct" and we
> should try and figure out why it didn't work: how come
> after-change-functions is not run (or not correctly) by call-process?
Yeah, that's a good point. Data inserted by call-process definitely
changes the buffer, so after-change-functions should be run.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 21 Nov 2019 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 216 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.