Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

tmp_home_path insecure #6501

Closed
boutil opened this issue Apr 23, 2018 · 3 comments · Fixed by #7416
Closed

tmp_home_path insecure #6501

boutil opened this issue Apr 23, 2018 · 3 comments · Fixed by #7416

Comments

@boutil
Copy link

boutil commented Apr 23, 2018

Hi,

If the home directory of the user is not writable the function tmp_home_path from lib/bundler.rb, creates an insecure temporary directory in tmp/:

  • it is a world writable
  • it has a with a predictable name.
    Moreover, this temporary directory is not removed at the end.

See:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=796383
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=881749
for more details.

Thanks in advance.

@ghost
Copy link

ghost commented Apr 23, 2018

Potentially useful information, for whoever attempts to fix this:

[Here's] how we suggest you (a Linux application developer) pick the right directory to use [for temporary files]:

  1. You need a place to put your socket (or other communication primitive) and your code runs privileged: use a subdirectory beneath /run. (Or beneath /var/run for extra compatibility.)
  2. You need a place to put your socket (or other communication primitive) and your code runs unprivileged: use a subdirectory beneath $XDG_RUNTIME_DIR.
  3. You need a place to put your larger downloads and downloads in progress and run unprivileged: use $XDG_DOWNLOAD_DIR.
  4. You need a place to put cache files which should be persistent and run unprivileged: use $XDG_CACHE_HOME.
  5. Nothing of the above applies and you need to place a small file that needs no persistency: use $TMPDIR with a fallback on /tmp. And use mkstemp(), and mkdtemp() and nothing homegrown.
  6. Otherwise use $TMPDIR with a fallback on /var/tmp. Also use mkstemp()/mkdtemp().

(Source.)

@colby-swandale
Copy link
Member

Thanks for the report, we will take a look at this issue when we can.

@ghost ghost closed this as completed in ac758c8 Nov 7, 2019
deivid-rodriguez pushed a commit that referenced this issue Nov 7, 2019
7416: Don't use insecure temporary directory as home directory r=deivid-rodriguez a=fatkodima

Closes #6501

Co-authored-by: fatkodima <fatkodima123@gmail.com>
(cherry picked from commit ac758c8)
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants