Subject: Re: bug#37196: 27.0.50; auth-source no longer obfuscates passwords

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 20 Sep 2019 22:05:34 +0200

Lars Ingebrigtsen <[email-masked]> writes:

> Emacs got a better pretty printer for compiled code sometime over the
> last few years, and that means that the obfuscator that auth-source uses
> no longer works.  (It puts the password into a closure.)
>
> With the following in ~/.authinfo
>
> machine foo.bar login zot password foobar
>
> we get
>
> (auth-source-search :max 1 :host "foo.bar")
> => ((:host "foo.bar" :user "zot" :secret #[0 "<binary>" [("foobar") (nil)] 3]))
>
> with the "foobar" clearly printed out.  This should be fixed by
> obfuscating the password in a different way.

I have now done this --

(auth-source-search :max 1 :host "foo.bar")
=> ((:host "foo.bar" :user "zot" :secret #[0 "..." [(103 112 112 99 98 115) (nil) apply string mapcar 1-] 6]))

It's not exactly super-secret, but I think that's as far as we can get
here.  I briefly considered having a per-session nonce stored in memory,
and then using an encryption primitive to obfuscate the data (that would
mean that anybody mistakenly mailing these around wouldn't be able to
root out the password without having access to the running Emacs
instance).

Hm.  Now that I typed that, it strikes me that this should be rather
trivial to do with gnutls-symmetric-encrypt on systems where that is
available.  I'll give it a go...

> Similarly, the printed representation of auth-source-netrc-cache also
> has the password in clear text now.

This was already OK.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no