-
Notifications
You must be signed in to change notification settings - Fork 117
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
Improved behavior when running under Microsoft Store python interpreters #73
base: master
Are you sure you want to change the base?
Improved behavior when running under Microsoft Store python interpreters #73
Conversation
Hi ! Thank you for the PR, I will try to have a in depth look in the next few days. I am curious about the inner working of "Microsoft Store python" and would like to explore it before giving my feedback on the PR. I will come back to it soon ! |
Thanks for the consideration @hakril, look forward to your findings. I am open to reworking / feedback. |
I toyed a little bit with the MsStore Concerning the tests: I am open to change but from what I understand other parts of PFW will still not work with For For Lastly, concerning the main point of
This would also allow to have a better understanding of other errors like:
What are your thoughts in this solution ? |
@hakril appreciate the thoughtful response. Noted re: In the hopes of keeping the MR small/focused on my specific issue I only worked on The test feedback makes sense, no notes. I greatly prefer your solution to the hardcoded path check. Is it possibly worth a footnote on the process docs to help guide users who run into that ACL footgun? Would you like me to implement your feedback in this request, or would you like to take it from here? I will not be put off either way 🙂 |
Related: should we skip certain tests when we know they can't be run on |
Yeah, the testing on I completely agree for the documentation update, putting it in the I that is OK for you, Il will work on the update of For now I don't think implementing skip of certain tests for |
I'm going to have time to circle back to this soon -- keeping this open for a little longer if thats alright. I'm finding myself exploring a couple more workarounds that could lean either on "copy-before-load", or reflective DLL injection. I'll propose it to you if I find something with good success. With your improved your error reporting PR in place I think it could be implemented decently as a fallback. Re: documentation -- I looked @ https://hakril.github.io/PythonForWindows/build/html/process.html#windows.winobject.process.WinProcess.execute_python I'll propose a small verbiage update. |
@hakril This is ready for your 👀 again. Feedback should be addressed. Let me know what you think, maintainer edits are allowed if you'd like to tweak anything. |
Thank you for the update ! It was almost perfect for me. I took the liberty to make some changes and push it to your branch:
And that's it ! If these changes are OK for you, I I’m good to go and merge it ! |
Thanks @hakril, I appreciate you! Merge away whenever it makes sense on your side 🚀 |
Proposing a small changeset as a result of investigating #72
What I've discovered is the windows store build of python is sandboxed - meaning other processes cannot access its runtime. This is the security configuration of windows store apps by default. So
pythonXX.dll
and others are set as such they're not executable in the remote process andLoadLibraryA
yields anERROR_ACCESS_DENIED
.I toyed with the idea of automatically copying the interpreter outside of the sandbox to work around, as well as prompting for UAC elevation to apply more open ACLs as a convenience. Ultimately I think the best option here is probably just going to be telling the user that sandboxed python installations are incompatible with the remote python execution feature. The other options I explored are filled with edge cases and thorny-bits. Open to thoughts 🧠
As it stands you'll find three changes in this MR:
Fix
test_get_current_process_modules
, which failed on Microsoft Store builds of python because the app execution alias filename doesn't match the PEB. If we lean onGetModuleFileNameA
we avoid the confusion caused by the NTFS reparse points.Fix
test_current_process_pe_imports
which failed on Microsoft Store builds of python because the store builds have no direct dependency onkernel32.dll
. I am proposing that we instead look for the python DLL dependency which we know will always be present, and rely on the first imported method.Lastly, if attempting remote python execution on a sandboxed python interpreter the library now provides a helpful error message explaining why the operation would ultimately fail.