Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
e548b2ef
Commit
e548b2ef
authored
Jun 29, 2013
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Plain Diff
Merge with 0.6.46 (to include additional fix for Distribute #375)
parents
54cea58c
0d20ce20
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
CHANGES.txt
CHANGES.txt
+8
-0
pkg_resources.py
pkg_resources.py
+26
-0
No files found.
CHANGES.txt
View file @
e548b2ef
...
...
@@ -58,6 +58,14 @@ Added several features that were slated for setuptools 0.6c12:
* Issue #3: Fixed NameError in SSL support.
------
0.6.46
------
* Issue #375: Issue a warning if the PYTHON_EGG_CACHE or otherwise
customized egg cache location specifies a directory that's group- or
world-writable.
------
0.6.45
------
...
...
pkg_resources.py
View file @
e548b2ef
...
...
@@ -14,6 +14,8 @@ method.
"""
import
sys
,
os
,
time
,
re
,
imp
,
types
,
zipfile
,
zipimport
import
warnings
import
stat
from
urlparse
import
urlparse
,
urlunparse
try
:
...
...
@@ -985,6 +987,7 @@ variable to point to an accessible directory.
extract, as it tracks the generated names for possible cleanup later.
"""
extract_path = self.extraction_path or get_default_cache()
self._warn_unsafe_extraction(extract_path)
target_path = os.path.join(extract_path, archive_name+'
-
tmp
', *names)
try:
_bypass_ensure_directory(target_path)
...
...
@@ -994,6 +997,29 @@ variable to point to an accessible directory.
self.cached_files[target_path] = 1
return target_path
@staticmethod
def warn_unsafe_extraction_path(path):
"""
If the default extraction path is overridden and set to an insecure
location, such as /tmp, it opens up an opportunity for an attacker to
replace an extracted file with an unauthorized payload. Warn the user
if a known insecure location is used.
See Distribute #375 for more details.
"""
if os.name == '
nt
' and not path.startswith(os.environ['
windir
']):
# On Windows, permissions are generally restrictive by default
# and temp directories are not writable by other users, so
# bypass the warning.
return
mode = os.stat(path).st_mode
if mode & stat.S_IWOTH or mode & stat.S_IWGRP:
msg = ("%s 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)." % path)
warnings.warn(msg, UserWarning)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment