Skip to content

fix: read asar contents through the archive's retained file handle - #52293

Merged
samuelmaddock merged 3 commits into
43-x-yfrom
trop/43-x-y-bp-fix-read-asar-contents-through-the-archive-s-retained-file-handle-1783570972086
Jul 9, 2026
Merged

samuelmaddock merged 3 commits into
43-x-yfrom
trop/43-x-y-bp-fix-read-asar-contents-through-the-archive-s-retained-file-handle-1783570972086

Conversation

@trop

@trop trop Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Backport of #52283

See that PR for details.

Notes: Fixed a browser-process crash (ValidateIntegrityOrDie) and spurious preload ENOENT errors when an app's app.asar is replaced on disk (e.g. by an updater or MDM software) while the app is running.

trop Bot and others added 3 commits July 9, 2026 04:22
Reads of packed asar contents re-opened the archive by path on every
read, while using file offsets and integrity hashes from the cached
header. If the asar on disk was replaced while the app was running
(e.g. by an updater or MDM software swapping the app bundle), the
fresh open would read the new file's bytes at the old header's
offsets, producing either a fatal integrity-check crash in
ValidateIntegrityOrDie (browser process) or a spurious ENOENT preload
error when the file was briefly missing.

Read through the base::File the Archive has held open since the
header was validated instead:

- Archive::ReadFileAt() does positional reads on the retained handle;
  asar::ReadFileToString() now uses it, fixing the preload startup
  data paths and nativeImage reads.
- Archive::DuplicateFile() hands streaming consumers a duplicate of
  the retained handle; AsarURLLoader now uses it for packed files
  instead of re-opening by path, fixing the equivalent block-hash
  FATAL in AsarFileValidator for file:// loads.

This matches the JS fs wrapper, which has always read through the
archive's retained fd. Content served after a swap is the version the
app launched with, consistently, until relaunch. In-place tampering is
still caught: the retained handle sees modified bytes and the hash
check fails as before.

Also removes the now-unused Archive::path() accessor so future
readers of archive contents can't accidentally reintroduce by-path
opens.

Co-authored-by: Samuel Attard <[email protected]>
Co-authored-by: Samuel Maddock <[email protected]>
Co-authored-by: Samuel Maddock <[email protected]>
@trop
trop Bot requested a review from MarshallOfSound July 9, 2026 04:23
@trop trop Bot added 43-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Jul 9, 2026
@samuelmaddock
samuelmaddock merged commit ec31a73 into 43-x-y Jul 9, 2026
136 of 138 checks passed
@samuelmaddock
samuelmaddock deleted the trop/43-x-y-bp-fix-read-asar-contents-through-the-archive-s-retained-file-handle-1783570972086 branch July 9, 2026 18:28
@release-clerk

release-clerk Bot commented Jul 9, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a browser-process crash (ValidateIntegrityOrDie) and spurious preload ENOENT errors when an app's app.asar is replaced on disk (e.g. by an updater or MDM software) while the app is running.

renovate Bot added a commit to cigaleapp/cigale that referenced this pull request Jul 27, 2026
##### [v43.1.1](https://github.com/electron/electron/releases/tag/v43.1.1)

### Release Notes for v43.1.1

#### Fixes

- Fixed a browser-process crash (`ValidateIntegrityOrDie`) and spurious preload `ENOENT` errors when an app's `app.asar` is replaced on disk (e.g. by an updater or MDM software) while the app is running. [#52293](electron/electron#52293) <sup>(Also in [42](electron/electron#52294), [44](https://github.com/electron/electron/pull/52292))</sup>

#### Other Changes

- Updated Chromium to 150.0.7871.114. [#52297](electron/electron#52297)
renovate Bot added a commit to cigaleapp/cigale that referenced this pull request Jul 27, 2026
##### [v43.1.1](https://github.com/electron/electron/releases/tag/v43.1.1)

### Release Notes for v43.1.1

#### Fixes

- Fixed a browser-process crash (`ValidateIntegrityOrDie`) and spurious preload `ENOENT` errors when an app's `app.asar` is replaced on disk (e.g. by an updater or MDM software) while the app is running. [#52293](electron/electron#52293) <sup>(Also in [42](electron/electron#52294), [44](https://github.com/electron/electron/pull/52292))</sup>

#### Other Changes

- Updated Chromium to 150.0.7871.114. [#52297](electron/electron#52297)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

43-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant