-
Notifications
You must be signed in to change notification settings - Fork 30k
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
child_process execFile / spawn throw non-descript exception on windows if exe requires elevation #9464
Comments
Does
|
It doesn't work like this. As I said: SomeTool.exe requires elevation, which means if you start it in cmd.exe or powershell it displays a UAC dialog and if the user accepts it the application is run in a separate administrator shell. The orignal shell doesn't receive an exit code. However, running execFile/spawn from node does not display an UAC dialog to begin with so SomeTool.exe isn't started at all. It can't be - unless node exploits a security bug in Windows to circumvent security measures. Whatever api node/libuv is using to spawn a process (I assume CreateProcess because ShellExecute would work and display a UAC dialog) fails immediately with an error code that says the user doesn't have the permission to run that exe and node doesn't report that error code back to the application. I just updated to node 6.9.1 to repeat the test. I also realized that using execFileSync might hide an aspect of the problem:
reports:
As you see, the error is reported synchronously as an exception, not as an error through the callback. |
FYI, It's using CreateProcess. |
|
uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED (740) if attempting to run an application that requires elevation. Add a Windows test that calls uv_spawn() with a helper .exe requires elevated permissions. Test should either run successfully if run with Administrator privileges or fail with the mapped error. Refs: nodejs/node#9464
uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED (740) if attempting to run an application that requires elevation. Add a Windows test that calls uv_spawn() with a helper .exe that requires elevated permissions. Test should either run successfully if run with Administrator privileges or fail with the mapped error. Refs: nodejs/node#9464
uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED (740) if attempting to run an application that requires elevation. Add a Windows test that calls uv_spawn() with a helper .exe that requires elevated permissions. Test should either run successfully if run with Administrator privileges or fail with the mapped error. Refs: nodejs/node#9464
uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED (740) if attempting to run an application that requires elevation. Add a Windows test that calls uv_spawn() with a helper .exe that requires elevated permissions. Test should either run successfully if run with Administrator privileges or fail with the mapped error. Refs: nodejs/node#9464
uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED (740) if attempting to run an application that requires elevation. Add a Windows test that calls uv_spawn() with a helper .exe that requires elevated permissions. Test should either run successfully if run with Administrator privileges or fail with the mapped error. Refs: nodejs/node#9464
uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED (740) if attempting to run an application that requires elevation. Add a Windows test that calls uv_spawn() with a helper .exe that requires elevated permissions. Test should either run successfully if run with Administrator privileges or fail with the mapped error. Refs: nodejs/node#9464
uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED (740) if attempting to run an application that requires elevation. Add a Windows test that calls uv_spawn() with a helper .exe that requires elevated permissions. Test should either run successfully if run with Administrator privileges or fail with the mapped error. Refs: nodejs/node#9464
uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED (740) if attempting to run an application that requires elevation. Add a Windows test that calls uv_spawn() with a helper .exe that requires elevated permissions. Test should either run successfully if run with Administrator privileges or fail with the mapped error. Refs: nodejs/node#9464
uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED (740) if attempting to run an application that requires elevation. Refs: nodejs/node#9464
uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED (740) if attempting to run an application that requires elevation. Add a Windows test that calls uv_spawn() with a helper .exe that requires elevated permissions. Test should either run successfully if run with Administrator privileges or fail with the mapped error. Refs: nodejs/node#9464
uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED (740) if attempting to run an application that requires elevation. Refs: nodejs/node#9464
Should this remain open until Node.js is updated to a version of libuv containing the fix? |
Yes, I'd say so. |
Refs: nodejs#9439 Fixes: nodejs#9464 Fixes: nodejs#9690 PR-URL: nodejs#10717 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED if attempting to run an application that requires elevation. Fixes: nodejs/node#9464 PR-URL: libuv#1154 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Refs: nodejs#9439 Fixes: nodejs#9464 Fixes: nodejs#9690 PR-URL: nodejs#10717 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Refs: nodejs#9439 Fixes: nodejs#9464 Fixes: nodejs#9690 PR-URL: nodejs#10717 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Refs: nodejs#9439 Fixes: nodejs#9464 Fixes: nodejs#9690 PR-URL: nodejs#10717 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Refs: nodejs#9439 Fixes: nodejs#9464 Fixes: nodejs#9690 PR-URL: nodejs#10717 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Refs: nodejs/node#9439 Fixes: nodejs/node#9464 Fixes: nodejs/node#9690 PR-URL: nodejs/node#10717 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
outputs
spawn generates the same error.
Obviously it would be better if this error was returned through the callback but I would also love to have a proper error code to react to the situation.
Not sure how execFile and spawn are implemented but it should be possible to report a proper errorcode as CreateProcess generates errorcode 740 if elevation is required.
The text was updated successfully, but these errors were encountered: