-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Current behavior
When opening the GUI for Cypress and then clicking on type of test (either e2e or component, doesn't matter which), it displays "Initializing Config... Please what while we load your project and find browsers installed on your system" and shortly after crashes with the console error below:
Error: Error while obtaining machine id: Error: Command failed: %windir%\System32\REG.exe QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography /v MachineGuid
ERROR: Registry editing has been disabled by your administrator.
at ChildProcess.exithandler (node:child_process:406:12)
at ChildProcess.emit (node:events:390:28)
at ChildProcess.emit (node:domain:475:12)
at maybeClose (node:internal/child_process:1064:16)
at Socket.<anonymous> (node:internal/child_process:450:11)
at Socket.emit (node:events:390:28)
at Socket.emit (node:domain:475:12)
at Pipe.<anonymous> (node:net:687:12)
at C:\Users\swaana\AppData\Local\Cypress\Cache\10.0.1\Cypress\resources\app\node_modules\node-machine-id\dist\index.js:1:7964
at ChildProcess.exithandler (node:child_process:413:5)
at ChildProcess.emit (node:events:390:28)
at ChildProcess.emit (node:domain:475:12)
at maybeClose (node:internal/child_process:1064:16)
at Socket.<anonymous> (node:internal/child_process:450:11)
at Socket.emit (node:events:390:28)
at Socket.emit (node:domain:475:12)
at Pipe.<anonymous> (node:net:687:12)
Desired behavior
Getting the unique machine id should not crash for non admin users. The issue is caused by the underlying library being used (node-machine-id) which is calling %windir%\System32\REG.exe to fetch a unique id from the registry. Even though it is only reading the key the command itself is sensitive on Windows machines and therefore closed for non-admin users. This library seems to be badly maintained as the last publish was 3 years ago and for a year there has already been an open PR to fix this but without any response.
For my situation I am able to get this ID as a non-admin by using Powershell ("Powershell.exe -Command (Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Cryptography).MachineGuid") and there are probably other ways as well. So the issue is with the library itself and not with there being limitations due to user privileges.
Test code to reproduce
Due to the system setup required for this I cannot reproduce this with a repo or a test. It requires a Windows setup with a user that is not an Administrator and perhaps also extra security preventing a user from running REG.exe as is the case for the company where I work.
Cypress Version
10.0.1
Other
No response