Skip to content

fix: don't abort the process when a JS accessor throws during value conversion - #53331

Merged
MarshallOfSound merged 1 commit into
44-x-yfrom
bp/44-x-y/53069
Aug 31, 2026
Merged

MarshallOfSound merged 1 commit into
44-x-yfrom
bp/44-x-y/53069

Conversation

@MarshallOfSound

@MarshallOfSound MarshallOfSound commented Aug 31, 2026 •

Copy link
Copy Markdown
Member

Backport of #53069

See that PR for details. The utility_ai_language_model.cc hunks are left out: that file does not exist on this line.

Notes: Fixed a renderer crash when an array with a throwing property getter is passed across contextBridge, and several main/utility-process crashes when option objects passed to Electron APIs contain throwing accessors or Proxy traps.

…onversion (#53069)

* fix: don't crash the renderer when a contextBridge array has a throwing getter

When a value crossing the context bridge contains a plain array, each index
is read with `arr->Get(context, i).ToLocalChecked()`. If the index is an
accessor that throws (e.g. `Object.defineProperty(arr, 0, { get() { throw
... } })`), `Get()` returns an empty `MaybeLocal` and `ToLocalChecked()`
aborts the renderer process. Web content in a sandboxed, context-isolated
renderer can trigger this just by passing such an array to any exposed
function, since the crash happens during argument marshaling.

Use `ToLocal()` and bail out of the copy, so the pending exception is
surfaced to the caller as a normal catchable error, the same way a
non-cloneable value is handled.

* fix: handle throwing accessors while deep-freezing contextBridge values

`DeepFreeze` walks every own property of the object exposed to the main
world with `ToLocalChecked()` reads. The walk can reach objects the page
controls (a DOM element or a main-world function handed back through the
bridge), and a throwing accessor on one of those aborts the renderer.

Check every `GetOwnPropertyNames`/`Get` result and stop freezing when one
fails, leaving the exception for the caller.

* fix: don't ToLocalChecked() an empty proxy in contextBridge global overrides

`OverrideGlobalValueFromIsolatedWorld` and
`OverrideGlobalPropertyFromIsolatedWorld` assume `PassValueToOtherContext`
never fails and unwrap its result with `ToLocalChecked()`. The conversion
can fail (for example on a value nested too deep or an array index whose
getter throws), which turned into a renderer abort. Return early instead.

* fix: don't crash on throwing getters in the HttpResponseHeaders converter

The `responseHeaders` object returned from a `webRequest.onHeadersReceived`
callback is read with `ToLocalChecked()` for the key list, each value, and
each element of an array value. A getter that throws (or a Proxy whose
`ownKeys` trap throws) left an empty `MaybeLocal` and aborted the main
process. Use checked reads and fail the conversion instead.

* fix: don't crash on throwing accessors in the std::set/std::map converters

`Converter<std::set<T>>` reads each array index and `Converter<std::map>`
enumerates property names with `ToLocalChecked()`. An array with a throwing
index accessor (e.g. `webRequest.onBeforeRequest({ urls })`) or a Proxy
whose `ownKeys` trap throws (e.g. `session.downloadURL(url, { headers })`,
`utilityProcess.fork(..., { env })`) aborted the process. Return false from
the conversion so the caller reports a normal error.

* fix: don't crash on a throwing ownKeys trap in the header-pair converter

`Converter<std::vector<std::pair<K, V>>>` (used for `net.request` and
`WebSocket` header options) unwrapped `GetPropertyNames()` with
`ToLocalChecked()`; a Proxy whose `ownKeys` trap throws aborted the process.
Check the result like the rest of the loop already does.

* fix: don't crash in Dictionary::IsEmptyObject when enumeration throws

`webContents.print(new Proxy({}, { ownKeys() { throw ... } }))` aborted the
main process because `IsEmptyObject()` unwrapped `GetOwnPropertyNames()`
with `ToLocalChecked()`. Treat a failed enumeration as "not empty" and let
the caller's later reads surface the exception.

* fix: don't crash in webFrame.setSpellCheckProvider on a throwing has trap

`provider->Has(...).ToChecked()` aborts the renderer when the provider is a
Proxy whose `has` trap throws. Use `FromMaybe(false)` so it is reported as
the existing "spellCheck has to be defined" error instead.

* fix: validate nativePixmap.planes entries in the shared texture converter

Each `planes` element was read with `ToLocalChecked()` and cast to an object
without checking. A throwing index accessor aborted the process and a
non-object element was a type confusion. Fail the conversion in both cases.

* fix: don't CHECK when a pooled worker context has redefined process/require

When a second worklet scope is pooled onto a thread that already has a Node
environment, `ShareEnvironmentWithContext` copies `process` and `require`
from the first context's global and `CHECK`s that the reads succeed. Script
in that first context can redefine either global with a throwing accessor
(both are configurable), which turned a script error into a renderer crash.
Read them under a `TryCatch` and fall back to the environment's own process
object / undefined.

* fix: don't crash the utility process on malformed LanguageModel results

The utility-process AI bridge trusted values coming back from the app's
`LanguageModel` implementation: stream chunks were `CHECK`ed to be objects
with a boolean `done`, `contextUsage` and `value` were read with
`ToLocalChecked()`, and the JS type predicates and `responseConstraint`
parsing unwrapped their results unchecked. A throwing getter, a non-object
chunk, or a predicate that throws aborted the utility process. Report an
error to the responder (or fall back to a safe default) instead.

* fix: use CreateDataProperty when filling freshly created arrays and errors

`Set(...).Check()` on a brand-new array or error object still runs setters
inherited from `Array.prototype` / `Error.prototype`. If app code has
installed a throwing setter there (for example on `Error.prototype.code`),
the `.Check()` aborts the main process. `CreateDataProperty` defines an own
data property without consulting the prototype chain, so it cannot throw
on these fresh objects.

(cherry picked from commit 13c8c5a)
@MarshallOfSound MarshallOfSound added backport This is a backport PR semver/patch backwards-compatible bug fixes labels Aug 31, 2026
@electron-cation electron-cation Bot added new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Aug 31, 2026
@trop trop Bot added the 44-x-y label Aug 31, 2026
@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) August 31, 2026 16:00
@MarshallOfSound MarshallOfSound added a11y and removed a11y backport This is a backport PR labels Aug 31, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Aug 31, 2026
@MarshallOfSound MarshallOfSound added backport This is a backport PR and removed new-pr 🌱 PR opened recently labels Aug 31, 2026
@MarshallOfSound
MarshallOfSound merged commit 443d7b3 into 44-x-y Aug 31, 2026
125 checks passed
@MarshallOfSound
MarshallOfSound deleted the bp/44-x-y/53069 branch August 31, 2026 17:48
@release-clerk

release-clerk Bot commented Aug 31, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a renderer crash when an array with a throwing property getter is passed across contextBridge, and several main/utility-process crashes when option objects passed to Electron APIs contain throwing accessors or Proxy traps.

renovate Bot added a commit to cigaleapp/cigale that referenced this pull request Sep 13, 2026
##### [v44.2.0](https://github.com/electron/electron/releases/tag/v44.2.0)

### Release Notes for v44.2.0

#### Fixes

- Fixed a pending read on a `net.request` chunked upload stream inside a protocol handler never settling when the request failed or was aborted. [#53373](electron/electron#53373) <sup>(Also in [43](electron/electron#53374), [45](https://github.com/electron/electron/pull/53368))</sup>
- Fixed a potential crash when using `menu.popup` with a frame from an offscreen rendered window. [#53362](electron/electron#53362) <sup>(Also in [43](https://github.com/electron/electron/pull/53432))</sup>
- Fixed an intermittent crash (access violation) on Windows when an ASAR integrity violation is detected, so the process now exits with code 1 as intended. [#53455](electron/electron#53455) <sup>(Also in [43](electron/electron#53456), [45](https://github.com/electron/electron/pull/53438))</sup>
- Fixed application crash after a large number of IPC messages from renderers. [#53417](electron/electron#53417) <sup>(Also in [42](electron/electron#53419), [43](electron/electron#53420), [45](https://github.com/electron/electron/pull/53418))</sup>
- Fixed native addons deriving from `node::ObjectWrap` aborting during garbage collection on Node.js 24.19.0 and later. [#53392](electron/electron#53392) <sup>(Also in [42](electron/electron#53394), [43](electron/electron#53393), [45](https://github.com/electron/electron/pull/53391))</sup>

#### Other Changes

- Backported fixes from upstream ANGLE, Chromium, Skia and V8. [#53479](electron/electron#53479)
- Improved throughput of responses that `protocol.handle` handlers return straight from `net.fetch`. [#53378](electron/electron#53378)
- Updated Chromium to 152.0.7977.76. [#53382](electron/electron#53382)
- Updated Node.js to v24.20.0. [#53250](electron/electron#53250)
##### [v44.1.1](https://github.com/electron/electron/releases/tag/v44.1.1)

### Release Notes for v44.1.1

#### Fixes

- Fixed `chrome.tabs.query()` returning tab `url` and `title` to extensions without the `tabs` permission or host access, aligning with `tabs.get`. [#53354](electron/electron#53354) <sup>(Also in [42](electron/electron#53355), [43](electron/electron#53356), [45](https://github.com/electron/electron/pull/53353))</sup>
- Fixed a renderer crash when an array with a throwing property getter is passed across `contextBridge`, and several main/utility-process crashes when option objects passed to Electron APIs contain throwing accessors or Proxy traps. [#53331](electron/electron#53331) <sup>(Also in [42](electron/electron#53329), [43](https://github.com/electron/electron/pull/53330))</sup>
- Fixed an intermittent crash at startup on Linux caused by a race between Pango and the main thread initializing fontconfig. [#53340](electron/electron#53340) <sup>(Also in [43](electron/electron#53339), [45](https://github.com/electron/electron/pull/53338))</sup>
- Fixed an issue where an exception thrown by a property getter on an object passed through `contextBridge` was swallowed instead of being thrown back to the caller. [#53335](electron/electron#53335) <sup>(Also in [43](electron/electron#53334), [45](https://github.com/electron/electron/pull/53297))</sup>
- Fixed main process crashes when navigating to `http://accessibility/` or `http://devtools/`, when an extension background page used `navigator.mediaDevices`, and when calling `SerialPort.forget()` for a disconnected device. [#53333](electron/electron#53333) <sup>(Also in [43](electron/electron#53332), [45](https://github.com/electron/electron/pull/53325))</sup>
- Fixed the PDF viewer failing to save an edited PDF with `NotAllowedError: Third party iframes are not allowed to show a file picker`. [#53328](electron/electron#53328) <sup>(Also in [43](electron/electron#53327), [45](https://github.com/electron/electron/pull/53326))</sup>
gwennlbh pushed a commit to cigaleapp/cigale that referenced this pull request Sep 14, 2026
##### [v44.2.0](https://github.com/electron/electron/releases/tag/v44.2.0)

### Release Notes for v44.2.0

#### Fixes

- Fixed a pending read on a `net.request` chunked upload stream inside a protocol handler never settling when the request failed or was aborted. [#53373](electron/electron#53373) <sup>(Also in [43](electron/electron#53374), [45](https://github.com/electron/electron/pull/53368))</sup>
- Fixed a potential crash when using `menu.popup` with a frame from an offscreen rendered window. [#53362](electron/electron#53362) <sup>(Also in [43](https://github.com/electron/electron/pull/53432))</sup>
- Fixed an intermittent crash (access violation) on Windows when an ASAR integrity violation is detected, so the process now exits with code 1 as intended. [#53455](electron/electron#53455) <sup>(Also in [43](electron/electron#53456), [45](https://github.com/electron/electron/pull/53438))</sup>
- Fixed application crash after a large number of IPC messages from renderers. [#53417](electron/electron#53417) <sup>(Also in [42](electron/electron#53419), [43](electron/electron#53420), [45](https://github.com/electron/electron/pull/53418))</sup>
- Fixed native addons deriving from `node::ObjectWrap` aborting during garbage collection on Node.js 24.19.0 and later. [#53392](electron/electron#53392) <sup>(Also in [42](electron/electron#53394), [43](electron/electron#53393), [45](https://github.com/electron/electron/pull/53391))</sup>

#### Other Changes

- Backported fixes from upstream ANGLE, Chromium, Skia and V8. [#53479](electron/electron#53479)
- Improved throughput of responses that `protocol.handle` handlers return straight from `net.fetch`. [#53378](electron/electron#53378)
- Updated Chromium to 152.0.7977.76. [#53382](electron/electron#53382)
- Updated Node.js to v24.20.0. [#53250](electron/electron#53250)
##### [v44.1.1](https://github.com/electron/electron/releases/tag/v44.1.1)

### Release Notes for v44.1.1

#### Fixes

- Fixed `chrome.tabs.query()` returning tab `url` and `title` to extensions without the `tabs` permission or host access, aligning with `tabs.get`. [#53354](electron/electron#53354) <sup>(Also in [42](electron/electron#53355), [43](electron/electron#53356), [45](https://github.com/electron/electron/pull/53353))</sup>
- Fixed a renderer crash when an array with a throwing property getter is passed across `contextBridge`, and several main/utility-process crashes when option objects passed to Electron APIs contain throwing accessors or Proxy traps. [#53331](electron/electron#53331) <sup>(Also in [42](electron/electron#53329), [43](https://github.com/electron/electron/pull/53330))</sup>
- Fixed an intermittent crash at startup on Linux caused by a race between Pango and the main thread initializing fontconfig. [#53340](electron/electron#53340) <sup>(Also in [43](electron/electron#53339), [45](https://github.com/electron/electron/pull/53338))</sup>
- Fixed an issue where an exception thrown by a property getter on an object passed through `contextBridge` was swallowed instead of being thrown back to the caller. [#53335](electron/electron#53335) <sup>(Also in [43](electron/electron#53334), [45](https://github.com/electron/electron/pull/53297))</sup>
- Fixed main process crashes when navigating to `http://accessibility/` or `http://devtools/`, when an extension background page used `navigator.mediaDevices`, and when calling `SerialPort.forget()` for a disconnected device. [#53333](electron/electron#53333) <sup>(Also in [43](electron/electron#53332), [45](https://github.com/electron/electron/pull/53325))</sup>
- Fixed the PDF viewer failing to save an edited PDF with `NotAllowedError: Third party iframes are not allowed to show a file picker`. [#53328](electron/electron#53328) <sup>(Also in [43](electron/electron#53327), [45](https://github.com/electron/electron/pull/53326))</sup>

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

No open projects
Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants