Skip to content

fix(javascript): ignore Electron callee names that only share a suffix - #2714

Closed
Facetomyself wants to merge 3 commits into
morluto:mainfrom
Facetomyself:fix/2678-electron-callee-boundary
Closed

Facetomyself wants to merge 3 commits into
morluto:mainfrom
Facetomyself:fix/2678-electron-callee-boundary

Conversation

@Facetomyself

Copy link
Copy Markdown

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

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 ✅ Completed 2026-10-13T19:00:28.507863Z 012114e New commits
ℹ️ 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.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issue was found.

Summary

The PR replaces loose suffix checks with exact member checks for loadFile, loadURL, and serviceWorker.register.

  • JavaScript analysis ignores callees that only share a suffix.

Reviews (6) · Last reviewed commit: "perf(javascript): share parsed callee pa..." · Reviewed by Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 536ade2906

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d69b21aff1

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open.

  1. thread 1

Each call now parses callee segments once and derives its display name from that array. The same named path representation flows into endpoint classification; service-worker matching consumes a pre-split constant and single-member load checks read the final segment. The web-bundle consumer uses the same contract. Superseded repeated AST walks and per-match string splitting were removed. Performance effects have not been measured.

Source-inspected at 62d7eada16734097b5eb4c8cb3e3b4b2351a0806. Tests, checks, builds and real-provider runs were not executed, as explicitly requested by the user. This resolves the source correction; no executed verification is claimed.

@morluto morluto added bug Something isn't working area: domain Domain logic, errors, and pure functions P2: medium Medium priority issue labels Oct 13, 2026
@morluto
morluto force-pushed the fix/2678-electron-callee-boundary branch from 62d7ead to 0215068 Compare October 13, 2026 18:32
Facetomyself and others added 3 commits October 14, 2026 02:57
morluto#2678)

loadFile, loadURL, and serviceWorker.register matched any callee ending with those spellings. uploadFile, downloadURL, and myserviceWorker.register were recorded as renderer or service-worker evidence, and the loadURL suffix also became a network endpoint.
A computed key that contains a dot was joined into the dotted callee name, so api["fake.loadURL"] still matched loadURL. Compare the tail of the AST member segments instead.
@morluto
morluto force-pushed the fix/2678-electron-callee-boundary branch from 0215068 to 012114e Compare October 13, 2026 18:57
morluto added a commit that referenced this pull request Oct 14, 2026
Preserve CommonJS literal paths and confined ESM URL semantics, including package main fallback, directory intent, Unicode identity, and present opaque modules. Parse extraction inputs at their AST/source owner, retain skipped HTML and source-map coverage, and distinguish endpoint candidates from proven receiver facts. Version structural fingerprints with computed literal contents and propagate them through worker contracts.

Reviewed fixes include #1810, #1840, #2642, #2700, #2702, #2714, #2803, #2960, #2968, #2986, #3035, and #3036.

Validation: 158 resolver tests passed; public CLI/MCP module lookup controls, package-main/Unicode workflows, and six builtin workflows passed in the current compiled lane. Worker schema/fingerprint regressions passed. Large public pdf.js completion and real Electron analysis remain unverified.
@morluto

morluto commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Superseded by the delivered change on main: b91b7e01a. Electron callee recognition distinguishes complete builtin names from suffix collisions, with positive and negative producer regressions. Closing this earlier proposal. Current main qualification passed: https://github.com/morluto/rea/actions/runs/38690953281.

@morluto morluto closed this Oct 15, 2026
@morluto

morluto commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Thanks @Facetomyself for catching Electron callee-name suffix collisions. Main has the identity correction so similarly named calls do not become Electron API evidence.

@morluto morluto added the provider: electron Analysis provider / engine: electron label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions bug Something isn't working P2: medium Medium priority issue provider: electron Analysis provider / engine: electron

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(javascript): unrelated callee names produce renderer and service-worker nodes

2 participants