* Re: master 893111f 2/2: Hide passwords in .authinfo and .netrc files [not found] ` <20190921100410.7BD4A20520@vcs0.savannah.gnu.org> @ 2019-09-21 14:05 ` Amin Bandali 2019-09-22 12:36 ` Lars Ingebrigtsen 0 siblings, 1 reply; 7+ messages in thread From: Amin Bandali @ 2019-09-21 14:05 UTC (permalink / raw) To: emacs-devel; +Cc: Lars Ingebrigtsen larsi@gnus.org (Lars Ingebrigtsen) writes: > + (while (re-search-forward "\\bpassword +\\([^\n\t ]+\\)" Would it make more sense to use '\s-' rather than '\b' here? With '\b', it will match the ‘password’ in an entry like `gnus-canlock-password' and thus wrongly add the display property to the next word, in this case “password”, rather than to the actual password itself. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 893111f 2/2: Hide passwords in .authinfo and .netrc files 2019-09-21 14:05 ` master 893111f 2/2: Hide passwords in .authinfo and .netrc files Amin Bandali @ 2019-09-22 12:36 ` Lars Ingebrigtsen 2019-09-22 13:27 ` Amin Bandali 0 siblings, 1 reply; 7+ messages in thread From: Lars Ingebrigtsen @ 2019-09-22 12:36 UTC (permalink / raw) To: Amin Bandali; +Cc: emacs-devel Amin Bandali <bandali@gnu.org> writes: > larsi@gnus.org (Lars Ingebrigtsen) writes: > >> + (while (re-search-forward "\\bpassword +\\([^\n\t ]+\\)" > > Would it make more sense to use '\s-' rather than '\b' here? With '\b', > it will match the ‘password’ in an entry like `gnus-canlock-password' > and thus wrongly add the display property to the next word, in this case > “password”, rather than to the actual password itself. Good point. I used \\b because I was thinking about whether "password" could be the first token on a the line, but I've now changed the regexp to be "\\(\\s-\\|^\\)password\\s-+\\([^\n\t ]+\\)" -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 893111f 2/2: Hide passwords in .authinfo and .netrc files 2019-09-22 12:36 ` Lars Ingebrigtsen @ 2019-09-22 13:27 ` Amin Bandali 2019-09-22 17:21 ` Lars Ingebrigtsen 0 siblings, 1 reply; 7+ messages in thread From: Amin Bandali @ 2019-09-22 13:27 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: emacs-devel Lars Ingebrigtsen <larsi@gnus.org> writes: > Amin Bandali <bandali@gnu.org> writes: > >> larsi@gnus.org (Lars Ingebrigtsen) writes: >> >>> + (while (re-search-forward "\\bpassword +\\([^\n\t ]+\\)" >> >> Would it make more sense to use '\s-' rather than '\b' here? With '\b', >> it will match the ‘password’ in an entry like `gnus-canlock-password' >> and thus wrongly add the display property to the next word, in this case >> “password”, rather than to the actual password itself. > > Good point. I used \\b because I was thinking about whether "password" > could be the first token on a the line, but I've now changed the regexp > to be > > "\\(\\s-\\|^\\)password\\s-+\\([^\n\t ]+\\)" Works well now, thanks! On a side note, I wonder it would be too much to have the keyword(s) be customizeable? For instance, I use my authinfo file to store entries with multiple “secret” parts, such as the following: machine xyz client-id 62308.619 client-secret ce2e92 token x-27f57e9a It would be nice if there were a defcustom e.g. `authinfo-hidden-parts', defaulting to “password”, which one could add other keywords to, such as “client-secret” and “token”. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 893111f 2/2: Hide passwords in .authinfo and .netrc files 2019-09-22 13:27 ` Amin Bandali @ 2019-09-22 17:21 ` Lars Ingebrigtsen 2019-09-23 2:06 ` Amin Bandali 0 siblings, 1 reply; 7+ messages in thread From: Lars Ingebrigtsen @ 2019-09-22 17:21 UTC (permalink / raw) To: Amin Bandali; +Cc: emacs-devel Amin Bandali <bandali@gnu.org> writes: > On a side note, I wonder it would be too much to have the keyword(s) be > customizeable? For instance, I use my authinfo file to store entries > with multiple “secret” parts, such as the following: > > machine xyz client-id 62308.619 client-secret ce2e92 token x-27f57e9a > > It would be nice if there were a defcustom e.g. `authinfo-hidden-parts', > defaulting to “password”, which one could add other keywords to, such as > “client-secret” and “token”. Yes, makes sense. Should that just be a list of tokens, or a regexp? If a regexp, I guess the function would have to be somewhat more rewritten to keep the bit that matches the secret bit in the right regexp grouping... -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 893111f 2/2: Hide passwords in .authinfo and .netrc files 2019-09-22 17:21 ` Lars Ingebrigtsen @ 2019-09-23 2:06 ` Amin Bandali 2019-09-23 10:28 ` Lars Ingebrigtsen 0 siblings, 1 reply; 7+ messages in thread From: Amin Bandali @ 2019-09-23 2:06 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: emacs-devel Lars Ingebrigtsen <larsi@gnus.org> writes: [...] > Yes, makes sense. Should that just be a list of tokens, or a regexp? > If a regexp, I guess the function would have to be somewhat more > rewritten to keep the bit that matches the secret bit in the right > regexp grouping... Cool. I think having a regexp would be great in terms of flexibility, but maybe not if it causes too much added complexity? Having a list would probably be simpler to implement and/or use. But of course, if we do go with a regexp, the user could always use C-h f regexp-opt RET to automatically generate a regexp from a list of strings, rather than hand-write it. I guess my vote would be a regexp, if it doesn’t make authinfo--hide-passwords overly complicated. Thanks for working on this, Lars. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 893111f 2/2: Hide passwords in .authinfo and .netrc files 2019-09-23 2:06 ` Amin Bandali @ 2019-09-23 10:28 ` Lars Ingebrigtsen 2019-09-23 13:47 ` Amin Bandali 0 siblings, 1 reply; 7+ messages in thread From: Lars Ingebrigtsen @ 2019-09-23 10:28 UTC (permalink / raw) To: Amin Bandali; +Cc: emacs-devel Amin Bandali <bandali@gnu.org> writes: > I guess my vote would be a regexp, if it doesn’t make > authinfo--hide-passwords overly complicated. No, it was more straightforward than I thought, so I've now done this on the trunk. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 893111f 2/2: Hide passwords in .authinfo and .netrc files 2019-09-23 10:28 ` Lars Ingebrigtsen @ 2019-09-23 13:47 ` Amin Bandali 0 siblings, 0 replies; 7+ messages in thread From: Amin Bandali @ 2019-09-23 13:47 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: emacs-devel Lars Ingebrigtsen <larsi@gnus.org> writes: > Amin Bandali <bandali@gnu.org> writes: > >> I guess my vote would be a regexp, if it doesn’t make >> authinfo--hide-passwords overly complicated. > > No, it was more straightforward than I thought, so I've now done this on > the trunk. Works great, thanks again! ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-09-23 13:47 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20190921100408.13688.51289@vcs0.savannah.gnu.org> [not found] ` <20190921100410.7BD4A20520@vcs0.savannah.gnu.org> 2019-09-21 14:05 ` master 893111f 2/2: Hide passwords in .authinfo and .netrc files Amin Bandali 2019-09-22 12:36 ` Lars Ingebrigtsen 2019-09-22 13:27 ` Amin Bandali 2019-09-22 17:21 ` Lars Ingebrigtsen 2019-09-23 2:06 ` Amin Bandali 2019-09-23 10:28 ` Lars Ingebrigtsen 2019-09-23 13:47 ` Amin Bandali
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.