Closed Nantris closed 2 years ago
npx @electron/fuses read --app path/to/Thing.app
Should output some info to the terminal about the current status of fuses
Thanks for the reply @MarshallOfSound!
I see the output EnableNodeCliInspectArguments is Disabled
- but Debugtron is still able to open debugger instances for the app, which it seems should not be possible if this fuse is having the desired effect. Is there something I'm overlooking?
@MarshallOfSound any thoughts on why this might be?
Note that the following code prevents Debugtron from working - which implies it uses the --inspect
flag, which implies that the fuse enableNodeCliInspectArguments: false
should prevent it from being able to debug an application, but this is not the case. Debugtron still works to debug the application.
// electron main
for (let i = 0; i < process.argv.length; i++) {
const arg = process.argv[i]
if (arg.indexOf('--inspect') !== -1 || arg.indexOf('--remote-debugging-port') !== -1) {
throw new Error('Not allow debugging this program.')
}
}
--remote-debugging-port is not affected by fuses, it is a Chromium flag that impacts renderer processes and as such can be filtered by the main app bundle if you choose.
Can you confirm if --inspect is working, or whether it is --remote-debugging-port you are seeing work?
Confirming the fuse works as intended. Sorry to waste time with a bad test case.
after adding fuse, unable to launch the app after pacakging the application.. removing the LoadBrowserProcessSpecificV8Snapshot resolves the issues in widnows but in mac still unable to launch the app
const { FusesPlugin } = require('@electron-forge/plugin-fuses'); const { FuseV1Options, FuseVersion } = require('@electron/fuses'); const forgeConfigMac = require('./forge-config-mac'); const forgeConfigWin = require('./forge-config-win'); const { logMessage } = require('./util');
if (process.platform === 'darwin') { logMessage('Loading macOS Forge config'); logMessage(JSON.stringify(forgeConfigMac, null, 2));
forgeConfigMac.plugins = [ new FusesPlugin({ version: FuseVersion.V1,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
[FuseV1Options.LoadBrowserProcessSpecificV8Snapshot]: true,
}),
];
module.exports = forgeConfigMac; } else if (process.platform === 'win32') { logMessage('Loading Windows Forge config'); logMessage(JSON.stringify(forgeConfigWin, null, 2));
forgeConfigWin.plugins = [ new FusesPlugin({ version: FuseVersion.V1,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
[FuseV1Options.LoadBrowserProcessSpecificV8Snapshot]: true,
}),
];
module.exports = forgeConfigWin; }
The fuse for
NODE_OPTIONS
logs to the console when it can't be used -NODE_OPTIONS have been disabled in this app
- but the others seem not to log anything, or perhaps are not being set properly.I ask because it seems like setting
[FuseV1Options.EnableNodeCliInspectArguments]: false
has no effect,--inspect
still seems to work (granted I am not testing it directly, but rather loading the app in Debugtron - which seems to simply run the app with--inspect
)Our configuration of the fuses is adapted from this code for setting fuses: https://github.com/electron-userland/electron-builder/issues/6365#issue-1033809141