mxc icon indicating copy to clipboard operation
mxc copied to clipboard

Node SDK: verifyExecutable refuses every path containing ".asar", including app.asar.unpacked and the MXC_BIN_DIR override

Open mrestrepo95 opened this issue 1 week ago • 0 comments

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

  1. Put the SDK at <app>\resources\app.asar.unpacked\node_modules\@microsoft\mxc-sdk\ with its bin\x64\wxc-exec.exe.
  2. Call getPlatformSupport() from the packaged app (or set MXC_BIN_DIR=<that bin folder>).
  3. 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).

mrestrepo95 avatar Nov 19 '26 13:11 mrestrepo95