mhinz / neovim-remote

:ok_hand: Support for --remote and friends.
MIT License
1.73k stars 83 forks source link

/tmp/nvmsocket is potentially insecure #102

Closed docwhat closed 5 years ago

docwhat commented 5 years ago

/tmp/nvmsocket is not safe on multi-user systems and should be stored someplace else.

My suggestion would be to use one of these in this order:

  1. $XDG_RUNTIME_DIR if set. There is a lame python package for this, but just seeing if the environment variable is set should be sufficient at this time.
  2. $TMPDIR for macOS for systems and systems with pam_mktemp it is tmp directory that is unique per user and is therefore safe.
  3. ${TMP:-/tmp/}/nvr-${USER}/socket or ${HOME}/.nvr/socket - The first would need to create the directory then check it exists, has the right permissions, and is owned by $USER before creating the socket.
mhinz commented 5 years ago

Everything you said is true. I decided against implementing it anyway for these reasons:

I added a short security note instead.

Probably not what you wanted to hear, but thanks for bringing it up anyway.