-
-
Notifications
You must be signed in to change notification settings - Fork 360
feat(suite-desktop): turn on ASAR integrity check via afterPack hook #17050
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| const { flipFuses, FuseV1Options, FuseVersion } = require('@electron/fuses'); | ||
| const path = require('path'); | ||
|
|
||
| // copied from https://github.com/electron-userland/electron-builder/blob/04be5699c664e6a93e093b820a16ad516355b5c7/packages/app-builder-lib/src/platformPackager.ts#L430-L434 | ||
| const binaryExtensionByPlaformNameMap = { | ||
| darwin: '.app', | ||
| win32: '.exe', | ||
| linux: '', | ||
| }; | ||
|
|
||
| exports.default = async function afterPack(context) { | ||
| const { electronPlatformName, appOutDir } = context; | ||
|
|
||
| /* | ||
| As of Electron 34.1.0, ASAR integrity: | ||
| - is not supported on Linux at all | ||
| - is supported on macOS, but does not work. TODO investigate & reenable | ||
| So we only set the appropriate fuses for Windows | ||
| */ | ||
| if (electronPlatformName !== 'win32') { | ||
| console.log('Skipping electron fuses '); | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| const ext = binaryExtensionByPlaformNameMap[electronPlatformName]; | ||
| const appName = context.packager.appInfo.productFilename; | ||
| const binaryFilename = `${appName}${ext}`; | ||
| const binaryPath = path.join(appOutDir, binaryFilename); | ||
|
|
||
| console.log(`Setting electron fuses on ${binaryPath}`); | ||
|
|
||
| await flipFuses(binaryPath, { | ||
| version: FuseVersion.V1, | ||
| [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true, | ||
| [FuseV1Options.OnlyLoadAppFromAsar]: true, | ||
| }); | ||
|
|
||
| console.log('Successfully set electron fuses'); | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,5 +162,6 @@ module.exports = { | |
| category: 'Utility', | ||
| target: ['AppImage'], | ||
| }, | ||
| afterPack: '../suite-desktop-core/scripts/setElectronFuses.js', | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, why is the new script |
||
| afterSign: '../suite-desktop-core/scripts/notarize.ts', | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.