Skip to content

feat(javascript): retain source-proven main-to-renderer IPC sends - #7210

Open
frabcd wants to merge 1 commit into
morluto:mainfrom
frabcd:codex/electron-main-transmissions
Open

frabcd wants to merge 1 commit into
morluto:mainfrom
frabcd:codex/electron-main-transmissions

Conversation

@frabcd

@frabcd frabcd commented Oct 26, 2026 •

Copy link
Copy Markdown

Summary

Retain source-proven main-to-renderer Electron IPC sends in static application analysis. BrowserWindow.webContents.send/postMessage and webContents.mainFrame.send/postMessage previously disappeared while corresponding renderer listeners remained visible.

Problem and expected behavior

On base 1173c0a9, a directory containing two main sends and two renderer listeners reports only 2 IPC operations. The change retains all 4, with main_transmissions: 2, source ranges and destination allocation identity. This is a static syntax result, not proof of delivery.

Change and scope

The existing BrowserWindow allocation/mutation resolver admits the four supported receiver/method combinations. Its allocation proof is shared with the mutation producer: proven native messaging and existing loadFile/loadURL operations preserve receiver identity, while argument escapes and invalidated receivers retain conservative effects. Loading checks the delegated WebContents methods too. This prevents a preceding load or send from hiding later sends on the same window. Main sends require receiver provenance in both the domain type and worker transport. Summary and graph consumers use those facts; no second receiver parser or runtime probe is added.

Distinct window allocations retain distinct channel nodes. Same channel text does not pair a main send with an arbitrary renderer listener. Dynamic channels stay unresolved; replaced, shadowed and lookalike receivers are excluded.

Contract and boundary impact

  • Semantic owner: Electron static IPC analysis, using the existing BrowserWindow receiver owner. Consumers: worker transfer, application summary and graph.
  • Contribution scope: existing static JavaScript/Electron boundary; no provider or target-execution authority change. No linked issue: this omission was reproduced while checking existing Electron work; the webview/wrapper work in feat(javascript): fold constant values and recover Electron boundaries through wrappers #2094 is separate.
  • CLI/MCP: existing analyze-javascript-application / analyze_javascript_application gain main send facts and summary.ipc.main_transmissions.
  • Compatibility: the new summary count is optional when reading retained Evidence. Historical absence remains unmeasured, not zero; current analysis emits the count.
  • Evidence: constructor location, receiver kind, call-site range, artifact identity and unknown delivery state survive projection.
  • Installation/package: no dependencies, setup behavior or release metadata changes. Generated catalogs and build outputs are not committed.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process. Existing internal analysis workers only.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

Executed baseline: the six new public CLI/MCP cases fail for missing main sends; four existing scoped IPC controls pass. The later repeated-send regression also failed on the intermediate implementation in both transports (11 operations instead of 12). Producer regressions exposed receiver escape after native loading. On the final change, 1,156 tests pass across 24 files, covering the semantic producer, both public transports, application projection, worker schema validation and receiver admission.

Coverage includes load-then-repeated-send, aliases, webContents/mainFrame operations, two same-channel windows, existing renderer-to-main pairing, dynamic channels, fake/shadowed/modified receivers, delegated loading method replacement, mandatory worker provenance and historical count absence. Targets are inert fixtures; no fixture code is executed. Scoped independent review found the loading regression fixed with no remaining actionable issue.

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • Source Vitest run over 20 affected Electron/member-mutation/Map/builtin regression files — 1,125 passed, 46.30s.
  • npm run test:focused -- tests/boundary/cli/electronMainTransmissions.test.ts tests/boundary/cli/electronScopedIpc.test.ts src/javascript/analysis/JavaScriptAnalysisWorkerSchemas.test.ts tests/boundary/filesystem/javascript-applications/electronApplicationAnalysis.test.ts — runtime build succeeded; 31 passed, 45.03s.
  • node scripts/rea.mjs analyze-javascript-application <fixture> --source-path main.cjs --source-path preload.cjs --format json — original two-send/two-listener fixture now reports operations: 4, main_transmissions: 2, renderer_listeners: 2; no speculative pairing.
  • npm run check — exit 0: typecheck, lint, formatting, Knip, metadata, module boundaries, architecture guards, reachability and typed lint. Typed lint reports 0 errors and 3,670 advisory warnings across 5,433 files; this is not a warning-free claim.
  • npm run docs:check — exit 0, including 9 README conformance tests.
  • npm run verify:test-discovery — all 2,498 test files discovered exactly once.
  • git diff --check — passed.

Windows x64, Node24.22.1, npm11.16.0, Vitest5.0.3. The locked Vite8.3.5 Rolldown native binding is blocked by Windows Application Control; its WASM backend cannot resolve the Windows source paths. Tests ran with Vitest's supported Vite7.3.7 peer in ignored local dependencies, using the repository's unchanged config. Manifests/lockfile and security controls were not modified. Exact locked Vite8 test execution remains unverified on this host.

Compatibility, safety, and release

No migration or target authority change. sendToFrame, event.reply, dynamically obtained WebContents and wrapper substitution beyond source-proven receivers remain unsupported by this pass. Receiving renderer identity, listener reachability and runtime delivery remain unverified. No real Electron GUI, Hopper, Ghidra or IDA session was exercised. This is not a performance improvement claim; agent tokens, CPU and process-family peak memory were not benchmarked.

Author readiness

Human owner: @frabcd

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • Human ownership and initial readiness declared.
  • CI and maintainer review completed; material scope questions resolved.

@greptile-apps

greptile-apps Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The reviewed changes appear safe to merge.

Summary

Retains source-proven Electron main-to-renderer sends through static analysis, worker transfer, application counts, and graph edges.

  • Static analysis keeps main sends from proven BrowserWindow receivers.
  • Application results show main sends with their receiver evidence.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Source call] --> B[Shared allocation and mutation checks]
  B --> C[IPC fact with receiver and source range]
  C --> D[Worker schema]
  D --> E[Main transmission count]
  D --> F[Allocation-scoped channel and sends edge]
  F --> G[Renderer delivery remains unknown]
Loading

Reviews (1) · Last reviewed commit: "feat(javascript): retain source-proven m..." · Reviewed by Greptile

@frabcd
frabcd marked this pull request as ready for review October 26, 2026 10:21
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-26T10:21:18.947048Z eef1244 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

frabcd commented Oct 26, 2026

Copy link
Copy Markdown
Author

Hi @morluto, this PR is ready for review. It preserves source-proven main-to-renderer Electron IPC sends, including repeated sends after loadFile/loadURL, while keeping runtime delivery unverified.

The author-readiness declaration is complete. The PR body includes the reproduction, 1,156 passing targeted tests, required check results, and the Windows/Vite validation limitation.

Could you take a look when you have time? Thanks!

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Thanks for this. On current main it conflicts in 13 hunks across 7 files, mostly in the JavaScript semantic core: javascriptSemanticMemberMutations.ts (4), electronStaticAnalysisIpc.ts (2), electronStaticRenderer.ts (2), JavaScriptAnalysisWorkerSchemas.ts (2), javascriptSemanticAnalysis.ts, ElectronBoundaryGraphIpc.ts and the worker schema test. Main's member-mutation and allocation handling changed substantially since 1173c0a9, so the receiver-provenance changes need to be re-applied to that code rather than mechanically merged. Please rebase onto current main, and I'll re-review the main-transmission retention then.

@morluto morluto added the enhancement New feature or request label Nov 23, 2026
@morluto

morluto commented Nov 24, 2026

Copy link
Copy Markdown
Owner

@frabcd thanks for the PR — this branch has merge conflicts with main. Could you merge or rebase onto the latest main and resolve them? Once it's clean and CI is green we can take another look.
cc @gensokyo-dev @dandgabr

@morluto morluto added the area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior label Nov 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants