Skip to content

fix: don't expose chrome.webstorePrivate to web pages - #53752

Merged
MarshallOfSound merged 1 commit into
mainfrom
fix/disable-webstore-private-api
Sep 9, 2026
Merged

MarshallOfSound merged 1 commit into
mainfrom
fix/disable-webstore-private-api

Conversation

@VerteDinde

Copy link
Copy Markdown
Member

Description of Change

Since the Chromium 152 roll (#52446), the webstorePrivate extension API lives in //extensions instead of //chrome (CL 7874276). As a result, Electron now compiles and registers every webstorePrivate.* function through the core generated registry. It also ships the core _api_features.json entry, which exposes the API to regular web pages on https://chromewebstore.google.com/*.

ElectronExtensionsAPIClient doesn't provide a WebstorePrivateAPIDelegate, and most of the browser-side functions dereference it without checking for null. If an app's webContents navigates to the Chrome Web Store, the page gets real chrome.webstorePrivate bindings in the main world, and the first call the store page makes crashes the browser process.

#52446 added fix_guard_webstoreprivateapi_factory_against_null_delegate.patch to fix the startup crash caused by the same missing delegate, but it left the API exposed. This issue only affects 44-x-y and later; 43-x-y predates the roll.

This PR restores the pre-152 behavior (the API isn't exposed anywhere) without adding a patch.

Checklist

Release Notes

Notes: Fixed a crash when a webContents navigated to the Chrome Web Store and the page invoked the unsupported chrome.webstorePrivate API.

Since the webstorePrivate API moved to //extensions (CL 7874276), the
core feature files expose it to web pages on the Chrome Web Store origin
and the core provider registers its functions. Electron does not provide
a WebstorePrivateAPIDelegate, so a webContents that navigated to
chromewebstore.google.com got chrome.webstorePrivate bindings and calling
into them dereferenced a null delegate in the browser process.

Override the core "webstorePrivate" feature so it is unavailable in every
context, and replace the core-registered functions with ones that respond
with an error so a stray request cannot crash the browser.
@VerteDinde VerteDinde added target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. labels Sep 8, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Sep 8, 2026
@VerteDinde VerteDinde added the semver/patch backwards-compatible bug fixes label Sep 8, 2026
@MarshallOfSound
MarshallOfSound merged commit cf80d75 into main Sep 9, 2026
103 checks passed
@release-clerk

release-clerk Bot commented Sep 9, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a crash when a webContents navigated to the Chrome Web Store and the page invoked the unsupported chrome.webstorePrivate API.

@trop

trop Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #53775

@trop

trop Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #53776

@trop trop Bot added in-flight/45-x-y in-flight/44-x-y merged/45-x-y PR was merged to the "45-x-y" branch. and removed target/45-x-y PR should also be added to the "45-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. in-flight/45-x-y labels Sep 9, 2026
@trop trop Bot added merged/44-x-y PR was merged to the "44-x-y" branch. and removed in-flight/44-x-y labels Sep 12, 2026
0x-noad pushed a commit to 0x-noad/freedom-browser that referenced this pull request Sep 18, 2026
…s Freedom (solardev-xyz#346)

Electron 44.3.0 (Chromium 152) registers the `webstorePrivate` extension API
and ships the core `_api_features.json` entry exposing it to ordinary web pages
on `https://chromewebstore.google.com/*`, with no WebstorePrivateAPIDelegate
behind it. The store calls `chrome.webstorePrivate.getReferrerChain()` as soon
as a detail page renders, which is a null-pointer method call on CrBrowserMain
— SIGSEGV, whole app gone.

Fixed upstream in electron/electron#53752, backported to 44-x-y in
electron/electron#53776, shipped in v44.4.0:

  "Fixed a crash when a webContents navigated to the Chrome Web Store and the
   page invoked the unsupported chrome.webstorePrivate API. #53776"

44.4.1 is the newest 44.x patch, so the pin goes there.

Also:

- test-e2e/live/chrome-webstore.spec.js — live regression test (the exposure is
  keyed on the real store origin, so no fixture can stand in for it): asserts
  `typeof chrome.webstorePrivate === 'undefined'` on the store front page, and
  that navigating to the issue's detail URL leaves the main process answering
  IPC for 30s afterwards. Clicks through Google's consent wall and the "switch
  to Chrome" promo, and pins `process.versions.electron` from inside the app.
  Wired into a new `e2e-chrome-webstore` CI job next to `e2e-ant`.

- scripts/check-electron-version.js (+ test, + a check in check-binaries.js) —
  closes the Linux non-repro trap: node_modules/electron was 43.4.1 while the
  lockfile pinned 44.3.0, and electron-builder packages the node_modules copy
  (app-builder-lib's computeElectronVersion reads its package.json), so a stale
  tree ran and shipped a different Electron from the one CI described.

- licenses-audit.json / LICENSE_AUDIT.md record the new lockfile-resolved
  version (licenses-audit.test.js enforces this), and comments claiming 44.3.0
  is "the Electron this repo ships" are reworded to say what it shipped then.
DeJeune pushed a commit to CherryHQ/cherry-studio that referenced this pull request Oct 8, 2026
<!-- Template from
https://github.com/kubevirt/kubevirt/blob/main/.github/PULL_REQUEST_TEMPLATE.md?-->
<!--  Thanks for sending a pull request!  Here are some tips for you:
1. Consider creating this PR as draft:
https://github.com/CherryHQ/cherry-studio/blob/main/CONTRIBUTING.md
-->

> ### Branch strategy
>
> - Active development targets `main`.

### What this PR does

Before this PR:

Chrome Web Store pages could crash Electron's browser process through
unsupported `chrome.webstorePrivate` APIs.

After this PR:

Electron 44.4.0 includes the upstream fix, and Linux builds pin the
corresponding verified SQLite artifacts.

<!-- (optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)`
format, will close the issue(s) when PR gets merged)*: -->

Fixes #: N/A

### Why we need it and why it was done in this way

The following tradeoffs were made:

Minimal Electron patch upgrade; existing browser controls and crash
recovery policy preserved

The following alternatives were considered:

Application-level navigation restrictions or crash-recovery changes

Links to places where the discussion took place: <!-- optional: slack,
other GH issue, mailinglist, ... -->

[Electron 44.4.0
release](https://github.com/electron/electron/releases/tag/v44.4.0),
[upstream fix](electron/electron#53752),
[verified Linux
artifacts](https://github.com/CherryHQ/cherry-studio-better-sqlite3/releases/tag/better-sqlite3-v12.11.1-electron-v44.4.0-r1)

### Breaking changes

<!-- optional -->

If this PR introduces breaking changes, please describe the changes and
the impact on users.

None

### Special notes for your reviewer

<!-- optional -->

Validation: static checks, 12 Linux-native tests, artifact
checksum/provenance checks, native BrowserView/webview isolation probes,
and Agent direct/link navigation with snapshots passed; selected Vitest
projects recorded 34,171 passes and two failures (system DNS resolving
`.invalid` and a temporary Git repository fetch), so the full gate
remains non-green.

Test additions: None

User guide update: Not required for this stability fix

### Checklist

This checklist is not enforcing, but it's a reminder of items that could
be relevant to every PR.
Approvers are expected to review this list.

- [x] Branch: This PR targets `main`
- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: [Write code that humans can
understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans)
and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle)
- [ ] Refactor: You have [left the code cleaner than you found it (Boy
Scout
Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html)
- [x] Upgrade: Impact of this change on upgrade flows was considered and
addressed if required
- [x] Documentation: A [user-guide update](https://docs.cherry-ai.com)
was considered and is present (link) or not required. Check this only
when the PR introduces or changes a user-facing feature or behavior.
- [x] Self-review: I have reviewed my own code (e.g., via
[`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`,
or GitHub UI) before requesting review from others

### Release note

<!--  Write your release note:
1. Enter your extended release note in the below block. If the PR
requires additional action from users switching to the new release,
include the string "action required".
2. If no release note is required, just write "NONE".
3. Only include user-facing changes (new features, bug fixes visible to
users, UI changes, behavior changes). For CI, maintenance, internal
refactoring, build tooling, or other non-user-facing work, write "NONE".
-->

```release-note
[Browser] Prevent Chrome Web Store extension detail pages from closing Cherry Studio during Agent browser control.
```

Signed-off-by: kangfenmao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. new-pr 🌱 PR opened recently semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants