unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Paul Eggert <eggert@cs.ucla.edu>,
	Stefan Kangas <stefan@marxist.se>, Eli Zaretskii <eliz@gnu.org>
Cc: 51327@debbugs.gnu.org
Subject: bug#51327: 28.0.60; emacsclient warns about XDG_RUNTIME_DIR when starting daemon on-demand
Date: Tue, 7 Dec 2021 22:57:28 -0800	[thread overview]
Message-ID: <3107b151-c56b-7c8d-7277-cbc39273a401@gmail.com> (raw)
In-Reply-To: <212e4974-785a-65e0-70cc-fed7ea3ddacf@cs.ucla.edu>

On 12/7/2021 11:03 AM, Paul Eggert wrote:
> Ulrich says the loophole is small because Emacs verifies that the 
> current user is the socket owner. However, small loopholes can still be 
> exploited: for example, an attacker could cause you to think that you're 
> connecting to your Emacs when you're really connecting to another of 
> your processes, and this could still lead to problems (particularly if 
> you're root).

While I understand that Ulrich's goal is for things to Just Work with 
Gentoo's app-emacs/emacs-daemon package (which puts the socket in 
$TMPDIR), it seems there's no way to get that without opening at least a 
small loophole.

When the user is guaranteed to be connecting to an Emacs daemon whose 
socket is in $TMPDIR, it's sufficient on Emacs 27 to just unset 
$XDG_RUNTIME_DIR first. However, from my discussion with Ulrich 
before[1], I believe one of the goals is to look in *both* places for a 
socket to be more flexible, as Emacs 28 currently does.

Doing that by default opens a loophole for all emacsclient users, but 
what about a command-line flag like `emacsclient 
--allow-tmpdir-loophole' and/or an environment variable like 
`EMACS_ALLOW_TMPDIR_LOOPHOLE=1 emacsclient' (with a better name, of 
course)? Then, the default behavior would be free of loopholes[2], but 
Ulrich's case could be achieved by passing that flag when calling 
emacsclient. It might even be possible for Gentoo to enable that for the 
user in the appropriate cases...

That's not as user-/distro-friendly as things just working 
automatically, but maybe it would be a decent compromise? Of course, if 
the loophole is small enough, maybe the current behavior in Emacs 28 is 
ok (aside from the warning message). I'm not an expert on the security 
implications though, so I don't have a strong opinion on which way to go 
here.

[1] https://lists.gnu.org/archive/html/emacs-devel/2021-11/msg00435.html
[2] Well, *known* loopholes...





  reply	other threads:[~2021-12-08  6:57 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22  4:58 bug#51327: 28.0.60; emacsclient warns about XDG_RUNTIME_DIR when starting daemon on-demand Jim Porter
2021-10-30 19:37 ` Jim Porter
2021-10-30 22:33   ` Paul Eggert
2021-12-07 11:26     ` Stefan Kangas
2021-12-07 14:27       ` Eli Zaretskii
2021-12-07 14:58         ` Stefan Kangas
2021-12-07 19:03           ` Paul Eggert
2021-12-08  6:57             ` Jim Porter [this message]
2021-12-08 19:06               ` Paul Eggert
2021-12-08 19:16                 ` Eli Zaretskii
2021-12-08 20:23                   ` Stefan Kangas
2021-12-08 21:56                     ` Ulrich Mueller
2021-12-08 22:56                       ` Jim Porter
2021-12-08 23:44                       ` Paul Eggert
2021-12-09  0:19                         ` Ulrich Mueller
2021-12-09  7:32                       ` Eli Zaretskii
2021-12-09  7:44                         ` Ulrich Mueller
2021-12-09 17:12                           ` Paul Eggert
2021-12-09 18:34                             ` Eli Zaretskii
2021-12-09 19:45                               ` Jim Porter
2021-12-09 19:48                               ` Paul Eggert
2021-12-09 19:57                                 ` Eli Zaretskii
2021-12-09 20:04                                   ` Paul Eggert
2022-09-10  5:01                                     ` Lars Ingebrigtsen
2022-09-10  5:53                                       ` Paul Eggert via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-09  4:10             ` Richard Stallman
2021-11-05 10:38 ` bug#51327: 28.0.60; emacsclient warns about XDG_RUNTIME_DIR when starting daemon on demand Ulrich Mueller
2021-11-05 17:54   ` Jim Porter
2021-11-05 18:05     ` Ulrich Mueller
2021-11-05 18:38       ` Jim Porter
2021-11-05 19:02         ` Ulrich Mueller
2021-11-11 13:04           ` Ulrich Mueller
2021-11-11 17:06             ` Jim Porter
2021-11-12  2:21               ` Paul Eggert
2021-12-07 14:58   ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3107b151-c56b-7c8d-7277-cbc39273a401@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=51327@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).