Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build environment leaves .python-eggs group writeable which causes UserWarnings #1748

Closed
tfoote opened this issue Dec 14, 2013 · 7 comments
Closed

Comments

@tfoote
Copy link

tfoote commented Dec 14, 2013

In my builds I have a few unit tests which checks command line tools for both expected stdout and stderr results. Due to the file permissions on the .python-eggs file in /home/travis I get the following error repeatedly on my python2.x builds. In python3.x it does not raise the same warnings.

/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/pkg_resources.py:1054: UserWarning: /home/travis/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
  warnings.warn(msg, UserWarning)

From this example job: https://travis-ci.org/vcstools/rosinstall/jobs/15428340

It appears that this warning is triggered when running python scripts which utilize pkg_resources.

I don't believe that this is my configuration issue as the file is outside my build directory. My .travis.yml is here: https://github.com/vcstools/rosinstall/blob/master/.travis.yml

language: python
python:
  - "2.6"
  - "2.7"
  - "3.2"
# command to install dependencies
install:
# develop seems to be required by travis since 02/2013
  - python setup.py build develop
  - sudo gpg --keyserver hkp://subkeys.pgp.net --recv-keys 16126D3A3E5C1192
  - sudo gpg --export --armor 16126D3A3E5C1192 | sudo apt-key add -
  - sudo apt-get clean
  - sudo apt-get install -qq zsh
  - sudo pip install vcstools nose-cov coverage pyyaml
# Set git config to silence some stuff in the tests
  - git config --global user.email "foo@example.com"
  - git config --global user.name "Foo Bar"
# Set the hg user
  - echo -e "[ui]\nusername = Your Name <your@mail.com>" >> ~/.hgrc
# Set the bzr user
  - bzr whoami "Your Name <name@example.com>"
# command to run tests
script:
  - python -c 'import sys; print(sys.path)'
# Local tests work even if ros.org is down
#  - nosetests test/local
  - nosetests test
notifications:
  email: false
matrix:
  allow_failures:
    - python: "3.2"

My workaround has been to disable all warnings inside those unit tests which is sub optimal.

@lddubeau
Copy link

Prompted by alisaifee's investigation of a test failure on our end, I've worked around this issue by adding these commands at the end of the list of installation commands, before the test suite is run:

mkdir $HOME/.python-eggs
chmod og-w $HOME/.python-eggs

@sarahhodne
Copy link
Contributor

We recently updated our build environments with several Python changes. Are you still seeing this?

@roidrage
Copy link
Contributor

roidrage commented May 9, 2014

Hey, we haven't heard back from you, so I'm closing this.

If you have any more issues, you can either give us an update here or file a new one.

@roidrage roidrage closed this as completed May 9, 2014
@ffledgling
Copy link

I seem to have run into a similar issue today. I'm getting the following error warning:

/home/travis/virtualenv/python2.7.6/lib/python2.7/site-packages/pkg_resources.py:991: UserWarning: /home/travis/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).

@joshk
Copy link
Contributor

joshk commented Jul 21, 2014

@dstufft do you know what this error means? is it something Travis needs to fix?

@dstufft
Copy link

dstufft commented Jul 24, 2014

Probably just a permission need needs fixed to make something not group/world writable.

@ffledgling
Copy link

Does this mean it's an issue on the Travis side or do I need to fix something in my project's source code?

dcolligan added a commit to dcolligan/ga4gh-server that referenced this issue Jan 16, 2015
dcolligan added a commit to dcolligan/ga4gh-server that referenced this issue Jan 16, 2015
isislovecruft added a commit to isislovecruft/bridgedb that referenced this issue Feb 10, 2015
Travis-CI issue #1748 [0] was causing non-deterministic CI test
failures, particularly in the lib/bridgedb/test/test_https.py
integration tests which use the Python mechanize module to test the
HTTPS server. [0]

This is a known Python security issue, particularly for WSGI server
setup. [2] [3] The fix is quite simple, just set the PYTHON_EGG_CACHE
environment variable to something unique to each CI build and ensure
that the PYTHON_EGG_CACHE directory exists.

 * FIXES issues with non-deterministic Travis-CI test failures due to a
   known security hole in shared Python .egg cache directories.

[0]: travis-ci/travis-ci#1748
[1]: https://travis-ci.org/isislovecruft/bridgedb/jobs/50169439#L1763
[2]: https://stackoverflow.com/questions/2192323/what-is-the-python-egg-cache-python-egg-cache
[3]: pypa/virtualenv#459
yentsun added a commit to yentsun/price_watch that referenced this issue Mar 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants