all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: password.el: A minor mode to hide sensitive information (passwords) using overlays.
       [not found] <CANmXxHPu5LOr872o7FPWjZvThXHcn_ik3OLbTEzb7bTJVucBhQ@mail.gmail.com>
@ 2012-11-20 10:06 ` Michael Albinus
  2012-11-20 15:33   ` Jürgen Hötzel
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2012-11-20 10:06 UTC (permalink / raw)
  To: Jürgen Hötzel; +Cc: help-gnu-emacs

Jürgen Hötzel <juergen@archlinux.org> writes:

Hi Jürgen,

> But there may be situation when you have to deal with passwords in
> plain text files.
>
> Example Usage:
>
> (require 'password-mode)
> (add-hook 'text-mode-hook 'password-mode)
>
> Source Repository:
>
> https://github.com/juergenhoetzel/password-mode

Nice package. I've tried it with my own ~/.authinfo.gpg file;
unfortunately it doesn't work out of the box due to limitations in
`password-mode-prefix-regex':

- You require a trailing ":" after any string of
  `password-mode-words'. Maybe you could make this optional.

- You allow only alpha numerical characters for passwords. I use also
  special characters like "@" in my passwords, which are not hidden. The
  password regexp could be more general (or customizable).

> Jürgen

Best regards, Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: password.el: A minor mode to hide sensitive information (passwords) using overlays.
  2012-11-20 10:06 ` password.el: A minor mode to hide sensitive information (passwords) using overlays Michael Albinus
@ 2012-11-20 15:33   ` Jürgen Hötzel
  2012-11-21  8:24     ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Jürgen Hötzel @ 2012-11-20 15:33 UTC (permalink / raw)
  To: Michael Albinus; +Cc: help-gnu-emacs

Hi Michael,

thanks a lot for you feedback!

2012/11/20 Michael Albinus <michael.albinus@gmx.de>:
> Jürgen Hötzel <juergen@archlinux.org> writes:
>
>
> Nice package. I've tried it with my own ~/.authinfo.gpg file;
> unfortunately it doesn't work out of the box due to limitations in
> `password-mode-prefix-regex':
>
> - You require a trailing ":" after any string of
>   `password-mode-words'. Maybe you could make this optional.

I introduced a new custom variable password-mode-password-prefix-regexs:
So you can change this.

> - You allow only alpha numerical characters for passwords. I use also
>   special characters like "@" in my passwords, which are not hidden. The
>   password regexp could be more general (or customizable).

Good catch. I now use [:graph:] as default and also made it customizable via
password-mode-password-regex.

Documentation update:

https://github.com/juergenhoetzel/password-mode/blob/master/README.md

Jürgen



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: password.el: A minor mode to hide sensitive information (passwords) using overlays.
  2012-11-20 15:33   ` Jürgen Hötzel
@ 2012-11-21  8:24     ` Michael Albinus
  2012-11-21 15:59       ` Jürgen Hötzel
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2012-11-21  8:24 UTC (permalink / raw)
  To: Jürgen Hötzel; +Cc: help-gnu-emacs

Jürgen Hötzel <juergen@archlinux.org> writes:

> Hi Michael,

Hi Jürgen,

> I introduced a new custom variable password-mode-password-prefix-regexs:
> So you can change this.

That looks much better now. Maybe you could polish a little bit the
default. I would make the colon optional, then .netrc or .authinfo files
are supported out of the box. And maybe you shall allow any space class
characters after the prefix. My proposal for a default value would be

  '("Password:?[[:space:]]+" "Passwort:?[[:space:]]+")

You might also mention in the docstring of that custom option, that the
regexps must not contain parentheses for grouping, otherwise your match
wouldn't work. Shy groups are OK.

Another minor annoyance is, that your code is activated only in case of
*inserting* a character. I have no simple solution at hand, because
there isn't a hook when deleting a character. Maybe you could remap keys
<delete-char> and <backspace> for the password string region, but I
don't know whether this covers all use cases.

Delete/undo is also problematic, because you don't know first hand which
password to enter as confirmation.

An alternative approach could be to mark the region which contains the
password with the `read-only' property and catch the `text-read-only'
error, which is raised when somebody tries to modify this region. In the
error handler, you could call your password change mechanery.

> Jürgen

Best regards, Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: password.el: A minor mode to hide sensitive information (passwords) using overlays.
  2012-11-21  8:24     ` Michael Albinus
@ 2012-11-21 15:59       ` Jürgen Hötzel
  0 siblings, 0 replies; 4+ messages in thread
From: Jürgen Hötzel @ 2012-11-21 15:59 UTC (permalink / raw)
  To: Michael Albinus; +Cc: help-gnu-emacs

Hi Michael,

2012/11/21 Michael Albinus <michael.albinus@gmx.de>:
> Jürgen Hötzel <juergen@archlinux.org> writes:
>
>> Hi Michael,
>
> Hi Jürgen,
>
>> I introduced a new custom variable password-mode-password-prefix-regexs:
>> So you can change this.
>
> That looks much better now. Maybe you could polish a little bit the
> default. I would make the colon optional, then .netrc or .authinfo files
> are supported out of the box. And maybe you shall allow any space class
> characters after the prefix. My proposal for a default value would be
>
>   '("Password:?[[:space:]]+" "Passwort:?[[:space:]]+")

Thanks. That makes sense: Done.

> You might also mention in the docstring of that custom option, that the
> regexps must not contain parentheses for grouping, otherwise your match
> wouldn't work. Shy groups are OK.

Thanks. Also done.
> Another minor annoyance is, that your code is activated only in case of
> *inserting* a character. I have no simple solution at hand, because
> there isn't a hook when deleting a character. Maybe you could remap keys
> <delete-char> and <backspace> for the password string region, but I
> don't know whether this covers all use cases.
>
> Delete/undo is also problematic, because you don't know first hand which
> password to enter as confirmation.
>
> An alternative approach could be to mark the region which contains the
> password with the `read-only' property and catch the `text-read-only'
> error, which is raised when somebody tries to modify this region. In the
> error handler, you could call your password change mechanery.


Yes, there is no easy solution. I implemented it using the overlay insert hook,
because i can easily distinguish my overlays from other overlays and
don't wanted
to fiddle with user key bindings which may be already customized.

I did not knew about the 'read-only'  option: Thanks. I will check it out!

Jürgen



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-11-21 15:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CANmXxHPu5LOr872o7FPWjZvThXHcn_ik3OLbTEzb7bTJVucBhQ@mail.gmail.com>
2012-11-20 10:06 ` password.el: A minor mode to hide sensitive information (passwords) using overlays Michael Albinus
2012-11-20 15:33   ` Jürgen Hötzel
2012-11-21  8:24     ` Michael Albinus
2012-11-21 15:59       ` Jürgen Hötzel

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.