Skip to content

Commit

Permalink
feat: add disableSanityCheckPackage to asar to allow custom electron …
Browse files Browse the repository at this point in the history
…fork asar integrity implementations (#8123)
  • Loading branch information
beyondkmp committed Mar 11, 2024
1 parent 00f46e6 commit 031d7d5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/dirty-rats-happen.md
@@ -0,0 +1,5 @@
---
"app-builder-lib": minor
---

feat: add disableSanityCheckPackage to allow encrypted asars
3 changes: 3 additions & 0 deletions docs/configuration/configuration.md
Expand Up @@ -187,6 +187,9 @@ Env file `electron-builder.env` in the current dir ([example](https://github.com
<li>
<p><code id="Configuration-removePackageKeywords">removePackageKeywords</code> = <code>true</code> Boolean - Whether to remove <code>keywords</code> field from <code>package.json</code> files.</p>
</li>
<li>
<p><code id="Configuration-disableSanityCheckPackage">disableSanityCheckPackage</code> = <code>false</code> Boolean - Whether to disable sanity check asar package (useful for custom electron forks that implement their own encrypted integrity validation)</p>
</li>
</ul>

<!-- end of generated block -->
Expand Down
5 changes: 5 additions & 0 deletions packages/app-builder-lib/scheme.json
Expand Up @@ -7152,6 +7152,11 @@
}
]
},
"disableSanityCheckPackage": {
"default": false,
"description": "Whether to disable sanity check asar package (useful for custom electron forks that implement their own encrypted integrity validation)",
"type": "boolean"
},
"dmg": {
"anyOf": [
{
Expand Down
6 changes: 6 additions & 0 deletions packages/app-builder-lib/src/configuration.ts
Expand Up @@ -279,6 +279,12 @@ export interface Configuration extends PlatformSpecificBuildOptions {
* @default true
*/
readonly removePackageKeywords?: boolean

/**
* Whether to disable sanity check asar package (useful for custom electron forks that implement their own encrypted integrity validation)
* @default false
*/
readonly disableSanityCheckPackage?: boolean
}

interface PackContext {
Expand Down
4 changes: 3 additions & 1 deletion packages/app-builder-lib/src/platformPackager.ts
Expand Up @@ -316,7 +316,9 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
}

const isAsar = asarOptions != null
await this.sanityCheckPackage(appOutDir, isAsar, framework)
if (!this.config.disableSanityCheckPackage) {
await this.sanityCheckPackage(appOutDir, isAsar, framework)
}
if (sign) {
await this.doSignAfterPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets)
}
Expand Down

0 comments on commit 031d7d5

Please sign in to comment.