This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: OS X installer build script: permissions not ensured
Type: behavior Stage: patch review
Components: macOS Versions: Python 3.3
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: ned.deily, nicholas.riley, ronaldoussoren
Priority: low Keywords: patch

Created on 2012-03-14 03:21 by nicholas.riley, last changed 2022-04-11 14:57 by admin.

Files
File name Uploaded Description Edit
perm.patch nicholas.riley, 2012-03-14 03:20 review
Messages (5)
msg155716 - (view) Author: Nicholas Riley (nicholas.riley) * Date: 2012-03-14 03:20
The OS X installer build script does not ensure that files had the correct permissions when being packaged; some files' permissions were affected by your umask when running the build script, and others by the permissions of the source tree.

This patch sets the umask, so script-created files get correct permissions, wraps shutil.copy so it does the same thing, and adapts the existing os.walk-based permissions fixer to run over everything else.

It also removes group writability for the Python framework, as this is more secure and consistent with how Apple installs Python in 10.7 and later.  If you need to install a Python package without being root, either use virtualenv/pythonv, ~/Library or ~/.local.  Ned Deily and I discussed this at the PyCon sprints and he will update the documentation to match.
msg192521 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-07-07 08:18
Ned: is this still relevant? On first glance the patch has not been applied yet, but the funtionality may have been added in another form.

Also, I don't agree with the removal of group write-permissions. The current permissions allow users with admin privileges to install new packages without hassle, removing the group write permissions will IMHO just lead to tutorials that tell users to use sudo to install and that would be worse than the current situation.
msg192581 - (view) Author: Nicholas Riley (nicholas.riley) * Date: 2013-07-07 18:55
I don't have time to check it, but it's easy enough to test - set your umask to 077 and try building an installer, see if the files get the correct permissions when installed.

I would hope tutorials would tell users to install the packages somewhere else, but you're probably right - sudo is the path of least resistance and is even less secure.
msg192583 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-07-07 19:41
Right. And I'm even more sensitive as usual about that after reading webpage that appearently popular with newbies and explains that you install Python by first removing /System/Library/Frameworks/Python.framework.  I still can't understand that the author of that page thought that this would be a good idea (not linking to it to avoid giving it more prominence).
msg192584 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-07-07 19:58
Removing the group write permissions on the framework directory would be a significant change in the user interface so I agree that change should not be made until and if we have something better for user installation.  The rest of the patch is still valid in the sense that nothing has changed in build-installer.py to ensure permissions (when not using /usr/bin/install).  This hasn't been a problem with building python.org installers because of the environment used to build them.  The patch is now out-of-date, though, due to subsequent changes to build-installer.py.  I'll look at refreshing and applying that part of it in conjunction with other updates in the pipeline.
History
Date User Action Args
2022-04-11 14:57:27adminsetgithub: 58507
2013-07-07 19:58:24ned.deilysetpriority: normal -> low

messages: + msg192584
2013-07-07 19:41:45ronaldoussorensetmessages: + msg192583
2013-07-07 18:55:36nicholas.rileysetmessages: + msg192581
2013-07-07 08:18:37ronaldoussorensetmessages: + msg192521
2012-03-14 03:33:36ned.deilysetstage: patch review
2012-03-14 03:33:23ned.deilysetassignee: ronaldoussoren -> ned.deily
2012-03-14 03:24:16nicholas.rileysetnosy: + ned.deily
2012-03-14 03:21:01nicholas.rileycreate