-
Notifications
You must be signed in to change notification settings - Fork 169
EXE installers: inherit permissions from $INSTDIR
for all-users installations
#991
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
Conversation
This reverts commit e9260fd.
…tor into all-users-permissions-win
I had to add the |
@@ -929,6 +960,144 @@ def test_virtual_specs_override(tmp_path, request, monkeypatch): | |||
) | |||
|
|||
|
|||
@pytest.mark.skipif(not ON_CI, reason="CI only") | |||
@pytest.mark.skipif(not sys.platform.startswith("win"), reason="Windows only") | |||
def test_allusers_exe(tmp_path, request): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a super useful test that nonetheless might feel foreign when compared to the other tests in this module. Can you add a docstring explaining what we are testing here and why? It's obvious now in the context of this PR, but it might not be in the future when this all of a sudden fails in the future for whatever reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good call. I added a detailed doc string to the function that also talks about the limitations of this test. It only tests that permissions are correctly applied. A more complete test would go through all permissions attached to each file and ensures that write permissions are unset for users who are not part of the local administrator group. However, this isn't part of the installer code either.
Co-authored-by: jaimergp <[email protected]>
I built our installer with this branch if you'd like to test: https://github.com/moorepants/anaconda-dee-config/actions/runs/15697333735 |
Co-authored-by: jaimergp <[email protected]>
🎉 Thanks for this fix! |
Description
For all-user installations, the permissions of the installation directory are changed manually to remove write access for authenticated, domain, and built-in users, and to add read and execute rights for domain and built-in users. This assumes that permissions applied to the installation directories are inherited by all files and subdirectories.
If a file has the
SDDL_PROTECTED
flag set (see Security Descriptors), these permissions are no inherited and thus not changed. The result is that users who are not part of the Administrators group(s) cannot use these files.One example where this flag is set is the exe entry points created by
_conda.exe
:conda-standalone
creates a hard link from the entry point in the extracted temporary directory to the installation directory. Windows automatically sets theSDDL_PROTECTED
flag in that case and the permissions are not changed at the end of the installation.The solution is to enable inheritance for all files and directories inside
$INSTDIR
while still protecting$INSTDIR
itself. This is done by a call toicacls
because it is much faster than callingAccessControl::EnableFileInheritance
on every file (local tests with onlyjupyter
show a difference of 30 seconds).The added tests fail for the Miniforge example without this addition, as expected.
Closes #828.
Checklist - did you ...
news
directory (using the template) for the next release's release notes?