-
-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathsetFuses.js
More file actions
32 lines (28 loc) · 1.24 KB
/
Copy pathsetFuses.js
File metadata and controls
32 lines (28 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { flipFuses, FuseVersion, FuseV1Options } = require('@electron/fuses');
async function setFuses(buildPath, electronBinaryPath) {
console.log('Setting Electron fuses for enhanced security...');
console.log('Binary path:', electronBinaryPath);
try {
await flipFuses(electronBinaryPath, {
version: FuseVersion.V1,
// Disable RunAsNode to prevent ELECTRON_RUN_AS_NODE bypass.
[FuseV1Options.RunAsNode]: false,
// Prevent NODE_OPTIONS injection.
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
// Prevent --inspect arguments from enabling a debugger.
[FuseV1Options.EnableNodeCliInspectArguments]: false,
// Encrypt browser cookies at rest where the platform supports it.
[FuseV1Options.EnableCookieEncryption]: true,
// Preserve existing compatibility choices.
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: false,
[FuseV1Options.OnlyLoadAppFromAsar]: false,
[FuseV1Options.LoadBrowserProcessSpecificV8Snapshot]: false,
[FuseV1Options.GrantFileProtocolExtraPrivileges]: true
});
console.log('Fuses set successfully');
} catch (error) {
console.error('Error setting fuses:', error);
throw error;
}
}
module.exports = { setFuses };