Node SDK: verifyExecutable refuses every path containing ".asar", including app.asar.unpacked and the MXC_BIN_DIR override
Relevant area(s)
Windows, Node SDK
Brief description of your issue
verifyExecutable in dist/v1/platform.js (1.1.0) returns false for any path where execPath.includes('.asar'):
// Paths inside Electron's app.asar exist to fs but can't be executed
if (execPath.includes('.asar')) {
return false;
}
The intent is right for app.asar, but the test is a substring, so it also refuses app.asar.unpacked, the folder Electron
apps unpack native code into precisely so that it can be executed. An Electron app that ships the SDK the usual way
(native code under app.asar.unpacked) therefore has a wxc-exec.exe the SDK will not use, getPlatformSupport()
reports the host unsupported, and the sandbox is never offered. The MXC_BIN_DIR override goes through the same check,
so pointing it at the unpacked helper does not help either.
What an embedder has to do today: ship wxc-exec.exe a second time outside the unpacked folder, sign it separately, and
set MXC_BIN_DIR around each synchronous SDK call (and restore it afterwards, so the variable does not leak into every
child process the app starts).
Steps to reproduce
- Put the SDK at
<app>\resources\app.asar.unpacked\node_modules\@microsoft\mxc-sdk\with itsbin\x64\wxc-exec.exe. - Call
getPlatformSupport()from the packaged app (or setMXC_BIN_DIR=<that bin folder>). - It reports the host unsupported, although the file exists and runs.
Expected behavior
Refuse only a path with an app.asar (or *.asar) segment, e.g. test path.split(/[\\/]/).some(s => s.toLowerCase().endsWith('.asar')),
so app.asar.unpacked is accepted.
Environment
@microsoft/mxc-sdk 1.1.0, Electron 45, Windows 11 (x64 and arm64 builds).