Skip to content

[Bug] 6.8.0 regression: the 512-reference alias bound in canonicalWebpackInteropBindings drops Electron windows and IPC handlers in a real Webpack app (Bitwarden) #7253

Open

Description

@Rinkia

Before submitting

Area

Evidence, artifacts, or reconstruction

Observed behavior

On Bitwarden desktop 2026.10.0, [email protected] reports fewer Electron facts for the Webpack main bundle than 6.7.0 did, on identical input and settings:

analyze-javascript-application app.asar --source-path main.js --source-path preload.js 6.7.0 6.8.0 main 19447516a
browser_windows 1 0 0
explicit_web_preferences 7 0 0
ipc.operations 145 112 112
ipc.main_handlers 50 32 32
literal main channels 33 32 (ipc.log lost) 32

All runs used NODE_OPTIONS=--max-old-space-size=5120, so the parent result budget isn't involved. Without it, 6.8.0 also reports "Expanded application relationships for main.js exceed the parent's result budget", which 6.7.0 didn't need.

The lost facts are ordinary Webpack member reads, for example in main.js:

const electron_1 = __webpack_require__(84157);          // line 124396
electron_1.ipcMain.on(ipc_channels_1.AUTOTYPE_MVP_IPC_CHANNELS.TOGGLE, …)   // line 124409, lost
this.win = new electron_1.BrowserWindow({ … })           // line 129766, lost

Of 64 window and handler nodes on 6.7.0, 22 are missing on 6.8.0: 19 main handlers and the window in main.js, and 2 renderer handlers in preload.js. The result says why: semantic_resource_limits: ["alias-selections"], electron_call_paths_limited: true, and the limitation "Alias selection expansion was conservatively bounded (maximum 512 additional selector states); selected paths remain unknown."

The same shape in a small bundle is still resolved on 6.8.0. I checked a minimal Webpack bootstrap whose factory does const electron_1 = __webpack_require__(84157); electron_1.ipcMain.on(…); new electron_1.BrowserWindow(…), and it gives 1 window and 1 handler. So the loss comes from the bound on a large bundle, not the pattern.

Cause (source-derived on 6.8.0 and main 19447516a): canonicalWebpackInteropBindings in src/domain/javascript/javascriptBundledRequireOrigin.ts walks references to decide whether a write may select the Webpack loader. When the walk passes SEMANTIC_ALIAS_SELECTION_LIMIT (512), loaderMayOwnReference returns true, so the loader is treated as possibly overwritten and Electron identity through __webpack_require__ is withheld. Bitwarden's main.js is a 5 MB bootstrap with 1,153 modules, so the walk passes 512 even though the loader is never reassigned. main.js has no assignment to __webpack_require__ itself, only the standard bootstrap property definitions (.c .d .e .f .m .nmd .o .r .s .u .v, one each) and the bootstrap's single module-cache write. The check arrived in 6.8.0, with e9fc8fb, 5cbcd58 and 4394e8b touching this path.

Raising the bound isn't a workaround. As an experiment I set SEMANTIC_ALIAS_SELECTION_LIMIT to 1,048,576 locally: the worker exhausted a 4,096 MiB heap on main.js, and the result dropped to 0 main handlers.

Reproduction

NODE_OPTIONS=--max-old-space-size=5120 rea analyze-javascript-application …/resources/app.asar \
  --source-path main.js --source-path preload.js --format json

Linux x64 container, Node 24.22.1; 6.7.0 and 6.8.0 from npm, main built from source.

Expected behavior

A bundle as large as Bitwarden's shouldn't lose Electron facts that 6.7.0 found, when nothing writes to the Webpack loader. Possible directions:

  • Answer "does any write select the loader?" from the set of write sites rather than by walking references from every read. In Bitwarden, the only writes involving the loader are the standard bootstrap property definitions.
  • Scope the bound per factory instead of per bootstrap.
  • If a bound remains, report which modules lost Electron identity (a count or locations), so the summary isn't read as 0 windows.

Impact and scope

This affects any large Webpack-bundled Electron main process. Bitwarden is one real case, and its only window plus its webPreferences disappear from the summary. The limitation is disclosed, but the headline numbers changed between 6.7.0 and 6.8.0 without any change in the input. It also prevents verifying #4490's fix (PR #6993) on a real app: that PR passes all six minimal fixtures but can't show the Bitwarden channel while this bound fires.

Activity

  1. added
    bug
    on Nov 5, 2026
  2. Davmunrey commented on Nov 14, 2026

    @Davmunrey
    Contributor

    Re-tested on main at 4502bd4 (Linux x64, Node 24.22.1), same input as the report: Bitwarden-2026.10.0-amd64.deb, sha256 fcabfc7d…7063f, app.asar sha256 3f129eb2…446bb.

    Observed

    rea analyze-javascript-application app.asar --source-path main.js --source-path preload.js --format json (default precision, 2m20s):

    Summary field 6.7.0 (report) 6.8.0 (report) main 4502bd4
    browser_windows 1 0 0
    explicit_web_preferences 7 0 0
    ipc.operations 145 112 0
    ipc.main_handlers 50 32 0
    • The graph still holds 43 ipc-handler and 89 ipc-channel nodes; the result carries "Conditional Electron findings are retained in the graph but excluded from proven boundary summary counts". No browser-window node is present.
    • Limitation reported: alias-selections at the default 512.
    • With --semantic-precision '{"alias_selections":200000}' the worker exhausts its 1024 MiB heap on main.js after 34 s and the summary is still all zeros. So the remediation the limitation text suggests does not work for this input.

    Where the budget is hit

    With a temporary trace on valueResourceLimits.add (main.js only), canonicalWebpackInteropBindings / loaderMayOwnReference no longer records the limit, so the walk named in this issue appears addressed (3e0599a). The limit is now recorded from these callers instead:

    • selectedRequireSourcesAt (via createRequireFactoryCallAt, semanticRequireCallAt, the intrinsic-invocation resolver)
    • hasCommonJsModuleSource (via isModuleObject, isCommonJsRequireDelegate)
    • localPropertyMethods in javascriptSemanticMemberMutations (property reads and the .some path)
    • SemanticAliasSelections.onLimit in javascriptSemanticReturnedReferences
    • enqueue / possiblePath in javascriptElectronAppPathChanges (four call sites)

    Source-derived, not verified

    Any single hit sets a file-wide alias-selections limit, and a file with any semantic resource limit has all its Electron findings treated as conditional. On a 5 MB, 1,153-module bundle one over-budget query anywhere is therefore enough to zero the proven summary, independent of whether that query is related to the Electron call path.

    Not done

    No fix attempted: which of these queries may safely stay local to the value they bound (instead of limiting the whole file) looks like a design decision for the maintainers. I did not measure 6.7.0 or 6.8.0 myself; those columns are from the report. Not tested with a larger --max-heap-mb.

  3. added
    provider: electron
    on Nov 23, 2026
  4. added
    area: evidence
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: evidencebugprovider: electron

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions