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

Use GetUserNameEx to get SID of current user to secure win32 files #166

Merged
merged 1 commit into from
Oct 7, 2019

Conversation

kevin-bates
Copy link
Member

Found that the SID obtained when using GetUserName was causing permission
issues because it wasn't the actual SID for the current user. By changing
the call to use GetUserNameEx with a parameter of NameSamCompatible,
the SID that was returned did indeed correspond to the current user. In
addition, analysis of the file using Windows explorer also showed the SID
being resolved to the current user's Windows ID, rather than a raw SID (as
before).

Co-authored-by: snapo 6347922+snapo@users.noreply.github.com

Found that the SID obtained when using GetUserName was causing permission
issues because it wasn't the actual SID for the current user.  By changing
the call to use `GetUserNameEx` with a parameter of `NameSamCompatible`,
the SID that was returned did indeed correspond to the current user.  In
addition, analysis of the file using Windows explorer also showed the SID
being resolved to the current user's Windows ID, rather than a raw SID (as
before).

Co-authored-by: snapo <6347922+snapo@users.noreply.github.com>
@MSeal
Copy link
Contributor

MSeal commented Sep 30, 2019

I tested this in as many ways as I could, and the changes all seem to work.

  • Inside a linux subsystem with linux config files (no windows paths)
  • Inside a linux subsystem with windows config files (forced the directories to be on the /c/ mnt)
  • Inside a linux subsystem calling the windows parent system installed python (linux calling windows process which uses code changes)
  • Windows 10 powershell executing with windows config files
  • Windows 10 admin powershell executing with windows config files
  • Windows 7 powershell executing with windows config files
  • Windows 7 admin powershell executing with windows config files

One thing I was not able to test was:

  • Windows installed for other languages (I couldn't find a working VM for a non-English install of windows)
  • Odd user group or managed user setups for corporate accounts

@kevin-bates
Copy link
Member Author

@minrk - this is the last of the changes that are needed for 4.6.0. Could you please cut a release as soon as possible?

@MSeal
Copy link
Contributor

MSeal commented Oct 2, 2019

@takluyver Do you have merge / release permissions? There's a lot of downstream issues being opened waiting on this fix.

@kevin-bates
Copy link
Member Author

Thank you @rgbkrk!

@rgbkrk
Copy link
Member

rgbkrk commented Oct 7, 2019

Check your email for an ask to get you both to have release permissions on jupyter-core. 😄 Thank you for helping the Windows users Kevin!

@kevin-bates
Copy link
Member Author

kevin-bates commented Oct 7, 2019

Will do - thank you. Is this a "be careful what you wish for" moment? 😄

@rgbkrk
Copy link
Member

rgbkrk commented Oct 7, 2019

image

@rgbkrk
Copy link
Member

rgbkrk commented Oct 7, 2019

Just happy to enable you all to keep things moving.

@minrk
Copy link
Member

minrk commented Oct 8, 2019

Thanks for getting this through, everyone!

@minrk minrk mentioned this pull request Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants