[PR #2714] [CLOSED] fix(javascript): ignore Electron callee names that only share a suffix #5336

Closed
opened 2026-10-31 01:05:50 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2714
Author: @Facetomyself
Created: 10/13/2026
Status: ❌ Closed

Base: main ← Head: fix/2678-electron-callee-boundary


📝 Commits (3)

  • dc22519 fix(javascript): ignore Electron callee names that only share a suffix (#2678)
  • 35fd2b3 fix(javascript): match Electron callees by AST member segments
  • 012114e perf(javascript): share parsed callee paths per call

📊 Changes

4 files changed (+214 additions, -16 deletions)

View changed files

➕ src/domain/javascript/javascriptStaticAnalysisCalleeBoundary.test.ts (+165 -0)
📝 src/domain/javascript/javascriptStaticAnalysisCalls.ts (+14 -8)
📝 src/domain/javascript/javascriptStaticAnalysisHelpers.ts (+31 -5)
📝 src/domain/webBundleAnalyzerInspection.ts (+4 -3)

📄 Description

Summary

Fixes #2678. Static JavaScript analysis no longer treats a callee as loadFile, loadURL, or serviceWorker.register just because its name ends with those characters. Exact calls and real member paths still match.

Problem and expected behavior

inspectCall used name.endsWith("loadFile"), name.endsWith("loadURL"), and name.endsWith("serviceWorker.register"). endpointArgument used the same loadURL suffix. The same function already requires name === "Worker" || name.endsWith(".Worker").

On the pre-fix sources, these calls were reported as renderer roles, service-worker references, or network endpoints:

  • uploadFile("./secret.html") and preloadFile("./also.html") became renderer loadFile calls
  • downloadURL(...), reloadURL(...), and notloadURL(...) became renderer loadURL calls and network endpoints
  • myserviceWorker.register("./nope.js") became a service-worker reference

win.loadFile, BrowserWindow.loadURL, navigator.serviceWorker.register, a bare loadFile(...), and win?.loadURL(...) should still be recognized.

Change and scope

isDottedCallee matches only an exact callee or a dotted path ending in .member. serviceWorker.register uses that same rule, so navigator.serviceWorker.register matches and myserviceWorker.register does not.

This is an ordinary fix inside the existing static-analysis boundary. No new provider, capability, or maintainer scope decision applies. indexedDB.open and caches.open still use a bare suffix and are not part of this change.

Follow the contribution scope.

Contract and boundary impact

  • Semantic owner and earliest changed stage: JavaScript static call classification in javascriptStaticAnalysisCalls.ts and endpointArgument in javascriptStaticAnalysisHelpers.ts, after the callee name is already built.
  • Contribution scope fit and linked maintainer decision: ordinary bug fix within existing static analysis; maintainer decision not applicable.
  • CLI and MCP/tool-catalog contract: unchanged. The same analysis result shape is returned; only false callee matches are dropped.
  • Provider, bridge, target-format, or platform compatibility: unchanged. No provider or bridge code changed.
  • Evidence, artifact, provenance, or reconstruction contract: false renderer, service-worker, and network-endpoint findings are no longer emitted for suffix collisions. Legitimate exact and dotted calls stay.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable. The change classifies an already parsed AST and does not execute the target.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • 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

  • Tests added: src/domain/javascript/javascriptStaticAnalysisCalleeBoundary.test.ts.

  • Base reproduction: with the new test present and the two source edits stashed, at base 67c7a24e, vitest run --project domain src/domain/javascript/javascriptStaticAnalysisCalleeBoundary.test.ts failed 1 and passed 1. The negative case received renderer roles for uploadFile, preloadFile, downloadURL, reloadURL, and notloadURL, network endpoints for the three URL names, and a service-worker reference for myserviceWorker.register. The positive case already passed.

  • After the fix: that file passed 2/2. electronStaticAnalysisOptions.test.ts passed 4, and webBundleAnalyzer.test.ts passed 22, including the existing window.win.loadURL endpoint case.

  • User-visible CLI/MCP output: no command or schema change. The corrected fields are static-analysis role_paths, references, and endpoints.

  • Remaining proof gaps: npm run check:fast, the full suite, and a real Electron application were not run.

  • 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

  • npx vitest run --project domain src/domain/javascript/javascriptStaticAnalysisCalleeBoundary.test.ts on the pre-fix sources — 1 failed, 1 passed.
  • The same command after the fix — 2 passed.
  • npx vitest run --project domain src/domain/javascript/electronStaticAnalysisOptions.test.ts src/domain/webBundleAnalyzer.test.ts src/domain/javascript/javascriptStaticAnalysisCalleeBoundary.test.ts — 28 passed.
  • Runtime: Node v22.23.0, npm 10.9.8, Vitest 5.0.3, on Windows.

Compatibility, safety, and release

  • Breaking changes or migration steps: none for exact calls and dotted member paths. Callees that only shared a suffix no longer produce those findings.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable. Coverage is the domain Vitest project on Windows.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new target access. The diff contains no secrets.

AI assistance

Grok assisted with the investigation, the patch, the regression test, validation, and this description. The branch is pushed from the Facetomyself fork.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/2714 **Author:** [@Facetomyself](https://github.com/Facetomyself) **Created:** 10/13/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/2678-electron-callee-boundary` --- ### 📝 Commits (3) - [`dc22519`](https://github.com/morluto/rea/commit/dc22519b89ad4738e04333fde58d7705f0cb845b) fix(javascript): ignore Electron callee names that only share a suffix (#2678) - [`35fd2b3`](https://github.com/morluto/rea/commit/35fd2b30641f8c89c9d9d7ad483bd57ccf7e0d0f) fix(javascript): match Electron callees by AST member segments - [`012114e`](https://github.com/morluto/rea/commit/012114e4562cb71ffb079fdc8b43a2ff99f1ea49) perf(javascript): share parsed callee paths per call ### 📊 Changes **4 files changed** (+214 additions, -16 deletions) <details> <summary>View changed files</summary> ➕ `src/domain/javascript/javascriptStaticAnalysisCalleeBoundary.test.ts` (+165 -0) 📝 `src/domain/javascript/javascriptStaticAnalysisCalls.ts` (+14 -8) 📝 `src/domain/javascript/javascriptStaticAnalysisHelpers.ts` (+31 -5) 📝 `src/domain/webBundleAnalyzerInspection.ts` (+4 -3) </details> ### 📄 Description ## Summary Fixes #2678. Static JavaScript analysis no longer treats a callee as `loadFile`, `loadURL`, or `serviceWorker.register` just because its name ends with those characters. Exact calls and real member paths still match. ## Problem and expected behavior `inspectCall` used `name.endsWith("loadFile")`, `name.endsWith("loadURL")`, and `name.endsWith("serviceWorker.register")`. `endpointArgument` used the same `loadURL` suffix. The same function already requires `name === "Worker" || name.endsWith(".Worker")`. On the pre-fix sources, these calls were reported as renderer roles, service-worker references, or network endpoints: - `uploadFile("./secret.html")` and `preloadFile("./also.html")` became renderer `loadFile` calls - `downloadURL(...)`, `reloadURL(...)`, and `notloadURL(...)` became renderer `loadURL` calls and network endpoints - `myserviceWorker.register("./nope.js")` became a service-worker reference `win.loadFile`, `BrowserWindow.loadURL`, `navigator.serviceWorker.register`, a bare `loadFile(...)`, and `win?.loadURL(...)` should still be recognized. ## Change and scope `isDottedCallee` matches only an exact callee or a dotted path ending in `.member`. `serviceWorker.register` uses that same rule, so `navigator.serviceWorker.register` matches and `myserviceWorker.register` does not. This is an ordinary fix inside the existing static-analysis boundary. No new provider, capability, or maintainer scope decision applies. `indexedDB.open` and `caches.open` still use a bare suffix and are not part of this change. Follow the [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope). ## Contract and boundary impact - Semantic owner and earliest changed stage: JavaScript static call classification in `javascriptStaticAnalysisCalls.ts` and `endpointArgument` in `javascriptStaticAnalysisHelpers.ts`, after the callee name is already built. - Contribution scope fit and linked maintainer decision: ordinary bug fix within existing static analysis; maintainer decision not applicable. - CLI and MCP/tool-catalog contract: unchanged. The same analysis result shape is returned; only false callee matches are dropped. - Provider, bridge, target-format, or platform compatibility: unchanged. No provider or bridge code changed. - Evidence, artifact, provenance, or reconstruction contract: false renderer, service-worker, and network-endpoint findings are no longer emitted for suffix collisions. Legitimate exact and dotted calls stay. - Target selection, authority, upstream behavior, and cleanup details: not applicable. The change classifies an already parsed AST and does not execute the target. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] 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 - Tests added: `src/domain/javascript/javascriptStaticAnalysisCalleeBoundary.test.ts`. - Base reproduction: with the new test present and the two source edits stashed, at base `67c7a24e`, `vitest run --project domain src/domain/javascript/javascriptStaticAnalysisCalleeBoundary.test.ts` failed 1 and passed 1. The negative case received renderer roles for `uploadFile`, `preloadFile`, `downloadURL`, `reloadURL`, and `notloadURL`, network endpoints for the three URL names, and a service-worker reference for `myserviceWorker.register`. The positive case already passed. - After the fix: that file passed 2/2. `electronStaticAnalysisOptions.test.ts` passed 4, and `webBundleAnalyzer.test.ts` passed 22, including the existing `window.win.loadURL` endpoint case. - User-visible CLI/MCP output: no command or schema change. The corrected fields are static-analysis `role_paths`, `references`, and `endpoints`. - Remaining proof gaps: `npm run check:fast`, the full suite, and a real Electron application were not run. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npx vitest run --project domain src/domain/javascript/javascriptStaticAnalysisCalleeBoundary.test.ts` on the pre-fix sources — 1 failed, 1 passed. - The same command after the fix — 2 passed. - `npx vitest run --project domain src/domain/javascript/electronStaticAnalysisOptions.test.ts src/domain/webBundleAnalyzer.test.ts src/domain/javascript/javascriptStaticAnalysisCalleeBoundary.test.ts` — 28 passed. - Runtime: Node v22.23.0, npm 10.9.8, Vitest 5.0.3, on Windows. ## Compatibility, safety, and release - Breaking changes or migration steps: none for exact calls and dotted member paths. Callees that only shared a suffix no longer produce those findings. - Real Hopper/Ghidra, browser, or OS coverage: not applicable. Coverage is the domain Vitest project on Windows. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new target access. The diff contains no secrets. ## AI assistance Grok assisted with the investigation, the patch, the regression test, validation, and this description. The branch is pushed from the Facetomyself fork. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:05:50 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5336
No description provided.