Skip to content

Commit

Permalink
feat: adds default fuses to templates (#3480)
Browse files Browse the repository at this point in the history
* adds fuses to templates

* adds more fuse defaults and comments for claritt
  • Loading branch information
yangannyx authored Feb 1, 2024
1 parent 2fe0f5d commit 71eb328
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 2 deletions.
14 changes: 14 additions & 0 deletions packages/template/base/tmpl/forge.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const { FusesPlugin } = require('@electron-forge/plugin-fuses');
const { FuseV1Options, FuseVersion } = require('@electron/fuses');

module.exports = {
packagerConfig: {
asar: true,
Expand Down Expand Up @@ -26,5 +29,16 @@ module.exports = {
name: '@electron-forge/plugin-auto-unpack-natives',
config: {},
},
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};
4 changes: 4 additions & 0 deletions packages/template/base/tmpl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"make": "electron-forge make",
"publish": "electron-forge publish"
},
"devDependencies": {
"@electron/fuses": "^1.7.0",
"@electron-forge/plugin-fuses": "^7.2.0"
},
"keywords": [],
"author": "",
"license": "MIT"
Expand Down
17 changes: 16 additions & 1 deletion packages/template/vite-typescript/tmpl/forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ import { MakerZIP } from '@electron-forge/maker-zip';
import { MakerDeb } from '@electron-forge/maker-deb';
import { MakerRpm } from '@electron-forge/maker-rpm';
import { VitePlugin } from '@electron-forge/plugin-vite';
import { FusesPlugin } from '@electron-forge/plugin-fuses';
import { FuseV1Options, FuseVersion } from '@electron/fuses';

const config: ForgeConfig = {
packagerConfig: {},
packagerConfig: {
asar: true,
},
rebuildConfig: {},
makers: [new MakerSquirrel({}), new MakerZIP({}, ['darwin']), new MakerRpm({}), new MakerDeb({})],
plugins: [
Expand All @@ -31,6 +35,17 @@ const config: ForgeConfig = {
},
],
}),
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};

Expand Down
2 changes: 2 additions & 0 deletions packages/template/vite-typescript/tmpl/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"devDependencies": {
"@electron/fuses": "^1.7.0",
"@electron-forge/plugin-fuses": "^7.2.0",
"@electron-forge/plugin-vite": "ELECTRON_FORGE/VERSION",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
Expand Down
18 changes: 17 additions & 1 deletion packages/template/vite/tmpl/forge.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
const { FusesPlugin } = require('@electron-forge/plugin-fuses');
const { FuseV1Options, FuseVersion } = require('@electron/fuses');

module.exports = {
packagerConfig: {},
packagerConfig: {
asar: true,
},
rebuildConfig: {},
makers: [
{
Expand Down Expand Up @@ -44,5 +49,16 @@ module.exports = {
],
},
},
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};
2 changes: 2 additions & 0 deletions packages/template/vite/tmpl/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"devDependencies": {
"@electron/fuses": "^1.7.0",
"@electron-forge/plugin-fuses": "^7.2.0",
"@electron-forge/plugin-vite": "ELECTRON_FORGE/VERSION"
}
}
13 changes: 13 additions & 0 deletions packages/template/webpack-typescript/tmpl/forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { MakerDeb } from '@electron-forge/maker-deb';
import { MakerRpm } from '@electron-forge/maker-rpm';
import { AutoUnpackNativesPlugin } from '@electron-forge/plugin-auto-unpack-natives';
import { WebpackPlugin } from '@electron-forge/plugin-webpack';
import { FusesPlugin } from '@electron-forge/plugin-fuses';
import { FuseV1Options, FuseVersion } from '@electron/fuses';

import { mainConfig } from './webpack.main.config';
import { rendererConfig } from './webpack.renderer.config';
Expand Down Expand Up @@ -33,6 +35,17 @@ const config: ForgeConfig = {
],
},
}),
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};

Expand Down
2 changes: 2 additions & 0 deletions packages/template/webpack-typescript/tmpl/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"devDependencies": {
"@electron/fuses": "^1.7.0",
"@electron-forge/plugin-fuses": "^7.2.0",
"@electron-forge/plugin-webpack": "ELECTRON_FORGE/VERSION",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
Expand Down
14 changes: 14 additions & 0 deletions packages/template/webpack/tmpl/forge.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const { FusesPlugin } = require('@electron-forge/plugin-fuses');
const { FuseV1Options, FuseVersion } = require('@electron/fuses');

module.exports = {
packagerConfig: {
asar: true,
Expand Down Expand Up @@ -45,5 +48,16 @@ module.exports = {
},
},
},
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};

0 comments on commit 71eb328

Please sign in to comment.