Skip to content

disable asarIntegrity and computeData call #9677

@nikitakot

Description

@nikitakot

I'm using custom patched electron build with encrypted asar archive support.

I also don't use EnableEmbeddedAsarIntegrityValidation fuse and disable it explicitly via @electron/fuses during build.

My build now fails with:

failed to build distributable RangeError: The value of "offset" is out of range. It must be >= 0 and <= 4. Received -2404272720
    at boundsError (node:internal/buffer:88:9)
    at readUInt32LE (node:internal/buffer:222:5)
    at Buffer.<anonymous> (node:internal/buffer:1003:50)
    at PickleIterator.readBytes (/Users/runner/work/exams-client/exams-client/node_modules/chromium-pickle-js/lib/pickle.js:65:21)
    at PickleIterator.readUInt32 (/Users/runner/work/exams-client/exams-client/node_modules/chromium-pickle-js/lib/pickle.js:39:17)
    at readAsarHeader (/Users/runner/work/exams-client/exams-client/node_modules/app-builder-lib/src/asar/asar.ts:160:40)
    at hashHeader (/Users/runner/work/exams-client/exams-client/node_modules/app-builder-lib/src/asar/integrity.ts:84:22)
    at async Promise.all (index 1)
    at computeData (/Users/runner/work/exams-client/exams-client/node_modules/app-builder-lib/src/asar/integrity.ts:73:18)
    at MacPackager.doPack (/Users/runner/work/exams-client/exams-client/node_modules/app-builder-lib/src/platformPackager.ts:321:25) {
  code: 'ERR_OUT_OF_RANGE'

By quickly looking at the code it seems like computeData tries to read my encrypted asar and fails.

What's the best way to fix that? Is a new flag required?

I was submitting a similar issue couple years ago - #8122

env info

$ cat package.json | rg electron
...
    "electron": {
    "electronVersion": "41.1.0",
...
    "@electron/fuses": "^2.1.1",
    "@electron/notarize": "^3.1.1",
    "@types/electron-devtools-installer": "^2.2.0",
    "electron-builder": "^26.8.1",
    "@sentry/electron": "7.10.0",
    "electron-store": "^8.2.0",
    "electron-updater": "^6.8.3",

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions