Skip to content
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

How to confirm fuse values at runtime? #6

Closed
Nantris opened this issue Feb 10, 2022 · 6 comments
Closed

How to confirm fuse values at runtime? #6

Nantris opened this issue Feb 10, 2022 · 6 comments

Comments

@Nantris
Copy link

Nantris commented Feb 10, 2022

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: electron-userland/electron-builder#6365 (comment)

@MarshallOfSound
Copy link
Member

npx @electron/fuses read --app path/to/Thing.app

Should output some info to the terminal about the current status of fuses

@Nantris
Copy link
Author

Nantris commented Feb 12, 2022

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?

@Nantris
Copy link
Author

Nantris commented Feb 15, 2022

@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.')
  }
}

@MarshallOfSound
Copy link
Member

--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?

@Nantris
Copy link
Author

Nantris commented Feb 15, 2022

Confirming the fuse works as intended. Sorry to waste time with a bad test case.

@Vrushabhlb
Copy link

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.RunAsNode]: false,
[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.RunAsNode]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
[FuseV1Options.LoadBrowserProcessSpecificV8Snapshot]: true,
}),
];

module.exports = forgeConfigWin;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants