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

WIndows: INSTALLDIR's permission seems not right. #134

Closed
wyzzoo opened this issue Jun 21, 2022 · 8 comments · Fixed by #207
Closed

WIndows: INSTALLDIR's permission seems not right. #134

wyzzoo opened this issue Jun 21, 2022 · 8 comments · Fixed by #207
Labels
Windows Platform: Windows

Comments

@wyzzoo
Copy link

wyzzoo commented Jun 21, 2022

INSTALLDIR's permissions seems not right.

Directory permissions after install swift-5.7-DEVELOPMENT-SNAPSHOT-2022-06-04-a-windows10.exe on Windows 10 x64:

>accesschk.exe -d c:/library

Accesschk v6.12 - Reports effective permissions for securable objects
Copyright (C) 2006-2017 Mark Russinovich
Sysinternals - www.sysinternals.com

c:\Library
  RW BUILTIN\Administrators
  RW NT AUTHORITY\SYSTEM
  R  BUILTIN\Users
  RW NT AUTHORITY\Authenticated Users

I don't think you want Authenticated Users Group has the write permission.

@wjk
Copy link

wjk commented Dec 29, 2022

If you move the INSTALLDIR somewhere under C:\Program Files, I understand that Windows would then apply those permissions automatically.

Besides, it looks like this exact change is currently being implemented in #139.

@compnerd
Copy link
Member

@wjk hmm, I don't see how that PR changes the permissions or the location (it merely renames swift to Swift). The runtime was moved into ProgramFiles a while ago. The toolchain remains under C:\Library as the default (for now). But, I do agree with this in principle - the toolchain image should not be mutable by NT AUTHORITY\Authenticate Users.

@wjk
Copy link

wjk commented Dec 30, 2022

I don't see how that PR changes the permissions or the location

My apologies. I confused what you were changing with what was already there. I would recommend moving the toolchain under ProgramFiles as well.

@compnerd
Copy link
Member

I don't see how that PR changes the permissions or the location

My apologies. I confused what you were changing with what was already there.

No worries; that PR is also not mine :)

I would recommend moving the toolchain under ProgramFiles as well.

I'd like to do that some day. However, the name is an issue - if we can rename Program Files to ProgramFiles perhaps - I really would prefer not having the space in the path at this point where the path handling is already not very robust.

@wjk
Copy link

wjk commented Dec 30, 2022

Unfortunately, the space in Program Files is non-negotiable.

@compnerd
Copy link
Member

Unfortunately, the space in Program Files is non-negotiable.

I know; but that also means that it is currently something that is not worth fighting over. Using the alternate path allows focus on the other larger issue of tool stability and quality. Once those are settled, I think going over the codepaths with a fine tooth comb to find any possible issues where the spaces could be a problem (e.g. VFS computation, name computation, etc).

@compnerd compnerd added the Windows Platform: Windows label Jan 3, 2023
@compnerd
Copy link
Member

compnerd commented Jun 6, 2023

Okay, I've played around a little bit with the toolchain. Given that we are already renaming part of the toolchain for version information, I think that we can also reasonably just move the toolchain portion safely as well. The current idea is to move the toolchain from %SystemDrive%\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain to %ProgramFiles%\Swift\Toolchains\[version]+Asserts.

@compnerd
Copy link
Member

compnerd commented Jun 9, 2023

So, moving to the per-user install would actually mean that we can be safe for the most part (unless the user has a space in the username). The install should get isolated to %LocalAppData%\Programs which shouldn't have a space and thus should be relatively safe. This would also drop the need for Administrator privileges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Windows Platform: Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants