-
Notifications
You must be signed in to change notification settings - Fork 381
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
(notepadplusplus) Automatic restart of running application during upgrade always launches new Notepad++ process with elevated privileges as user who ran choco upgrade
regardless of original running user
#2334
Comments
Is this something you will be submitting a PR for? |
No, sorry, I did not have any immediate plans to write a patch for this myself. I'm not an everyday user of Chocolatey (yet), but my company is evaluating it for possible organizational use. As part of that evaluation, I was going through the training material and documentation, which uses the notepadplusplus package from the community repository as the example, so that's why I started poking, prodding, and experimenting with this package in particular. (And yes, we will be using our own internal repository if we decide to move forward with adopting Chocolatey as an organization.) Having encountered this issue during my testing, I felt a responsibility to at least file what I hope is a useful bug report. |
This does sound like something that would be useful to fix/support, not just for the Notepad++ package. As such, I think we need to update one of our extensions with support of running a process as non-elevated, and then update the Notepad++ package to call this extension CMDLET. As such, I have created chocolatey-community/chocolatey-extensions#15 to track this work. |
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Please do not add a comment to circumvent automatic closure unless you plan to help move it forward. |
Dear contributor, As this issue seems to have been inactive for quite some time now, I've automatically closed it. |
Since this issue is pending chocolatey-community/chocolatey-extensions#15, shouldn't it remain open? |
Normally I would probably say no, but I agree in this case that we should probably leave this issue open. It is basically being blocked until support is added in the |
Until the work is done in |
Chocolatey Version
2.2.2
Chocolatey License
None
Package Version
8.5.7 -> 8.5.8
Current Behaviour
When running
choco upgrade notepadplusplus
and an existing instance of Notepad++ is running, the package logic shuts down the running process, then performs the upgrade, then relaunches Notepad++ in an attempt to bring back the user's Notepad++ session using the newly updated version of the Notepad++ executable. The restart logic, however, does not consider which user was running the application before shutting it down, and the simpleStart-Process
directive launches the new instance of Notepad++ in such a way that the new process inherits both the user and the elevated privilege of the Chocolatey process runningchoco upgrade
.Expected Behaviour
When the Chocolatey package relaunches Notepad++, the spawned process should run as the original user who was running it before the package upgrade logic shut it down. Also, Chocolatey should not escalate privileges for the new process if the old process was running with regular user permissions (which is most commonly how Notepad++ is run).
Steps To Reproduce
This can fail in several interesting ways:
Case 1:
MyAdmin
user is logged into Windows and running Notepad++ in their own user session without elevated permissions.MyAdmin
attempts to save a new file or modify an existing file underC:\Windows\
, and they receive an error about not having the proper permissons, as expected.MyAdmin
runs Command Prompt as Administrator (with elevated permissions) where they executechoco upgrade notepadplusplus
, and the upgrade completes normally, including shutting down and relaunching Notepad++.MyAdmin
is able to successfully save the file without any permission errors.Case 2:
OtherGuy
user is logged into Windows and running Notepad++ in their own user session without elevated permissions.OtherGuy
logged in, tell Windows to switch users toMyAdmin
.MyAdmin
runs Task Manager and verifies on the "Details" tab that Notepad++ is still running and that the running user isOtherGuy
.MyAdmin
runs Command Prompt as Administrator (with elevated permissions) where they executechoco upgrade notepadplusplus
, and the upgrade completes normally, including shutting down and relaunching Notepad++.MyAdmin
's Windows user session. Also note that the titlebar is suffixed with "[Administrator]".OtherGuy
.OtherGuy
's Windows user session like there was before the upgrade.Case 3:
LimitedUser
user is logged into Windows and running Notepad++ in their own user session without elevated permissions.MyAdmin
(with elevated permissions).tasklist /V /FI "ImageName eq notepad++.exe" /FO LIST
and note that under "User Name" the user running Notepad++ is shown asLimitedUser
.MyAdmin
executeschoco upgrade notepadplusplus
, and the upgrade completes normally, including shutting down and relaunching Notepad++.LimitedUser
's Windows session, which is expected.tasklist /V /FI "ImageName eq notepad++.exe" /FO LIST
and note that under "User Name" the user running Notepad++ is now shown asMyAdmin
, which is not expected.MyAdmin
closes their elevated command prompt window, hands control back of the machine back toLimitedUser
, and walks away from the computer, thinking everything is OK.LimitedUser
starts using the instance of Notepad++ running within their Windows session and notices there is a new suffix of "[Administrator]" in the titlebar.LimitedUser
uses Notepad++ to create or modify system files that they otherwise don't have permission to change, e.g.C:\Windows\System32\drivers\etc\hosts
.Environment
Operating System:
Microsoft Windows NT 10.0.19044.0
(Windows 10)PowerShell Version:
Chocolatey Log
https://gist.github.com/blkeller/66cfbf75a89d8dd9c1b60726f92011ba
Anything else?
No response
The text was updated successfully, but these errors were encountered: