[PR #3044] [MERGED] fix(javascript): report EventSource and sendBeacon URLs as network endpoints #5576

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3044
Author: @xpeng5278-web
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @morluto

Base: main ← Head: fix/browser-request-endpoints


📝 Commits (1)

  • aabdcbe fix(javascript): report EventSource and sendBeacon URLs as network endpoints

📊 Changes

3 files changed (+84 additions, -1 deletions)

View changed files

➕ src/domain/javascript/javascriptStaticAnalysis.event_source.test.ts (+40 -0)
➕ src/domain/javascript/javascriptStaticAnalysis.send_beacon.test.ts (+34 -0)
📝 src/domain/javascript/javascriptStaticAnalysisHelpers.ts (+10 -1)

📄 Description

Summary

Fixes #3042

Literal new EventSource(url) and navigator.sendBeacon(url, data) URLs are now reported as network endpoints, the same way WebSocket, fetch and XMLHttpRequest.open URLs already are.

Problem and expected behavior

Trigger: new EventSource("/api/chat/stream") or navigator.sendBeacon("/api/telemetry", payload). Before this change, endpointArgument had no case for either API, so static analysis and web-bundle analysis returned no endpoint for an app's server-sent-event stream or its beacon POST targets.

Expected: the literal first argument is reported with mechanism call:EventSource / call:window.EventSource or call:navigator.sendBeacon / call:window.navigator.sendBeacon. Dynamic arguments stay unreported.

Change and scope

endpointArgument (src/domain/javascript/javascriptStaticAnalysisHelpers.ts) now:

  • treats EventSource / *.EventSource like WebSocket and returns the literal first argument;
  • returns the literal first argument for sendBeacon / *.sendBeacon.

That helper is the single owner shared by javascriptStaticAnalysisCalls and webBundleAnalyzerInspection, so both consumers get the fix.

Not included: the semantic request IR (requestMethod in javascriptSemanticDataEffects.ts). Adding methods to its enum would change the tool output schema, so that is left for a separate decision.

This is additive next to the fetch/WebSocket branch that open PR #2878 also edits. If #2878 lands first, the rebase is a trivial merge of the condition.

Follow the contribution scope.
Ordinary fix within existing boundaries; maintainer scope decision: not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: endpointArgument (static endpoint extraction)

  • Contribution scope fit and linked maintainer decision: ordinary fix within existing boundaries; not applicable

  • CLI and MCP/tool-catalog contract: no schema change; additional endpoint findings only

  • Provider, bridge, target-format, or platform compatibility: none

  • Evidence, artifact, provenance, or reconstruction contract: none

  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable

  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none

  • 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 or updated: src/domain/javascript/javascriptStaticAnalysis.event_source.test.ts and src/domain/javascript/javascriptStaticAnalysis.send_beacon.test.ts. They cover literal, window.-qualified and dynamic-URL cases.
  • Base reproduction or other evidence: executed. On base 20e4f8309 the two literal-URL tests fail (2 failed, 2 passed) because no EventSource or beacon endpoint is returned. With the fix, all 4 pass.
  • User-visible CLI/MCP output (if applicable): additional endpoint entries such as { kind: "network", value: "/api/chat/stream", mechanism: "call:EventSource" } and { kind: "network", value: "/api/telemetry", mechanism: "call:navigator.sendBeacon" }.
  • Remaining proof gaps: no live browser capture run.

For evidence-bearing changes:

  • 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

  • npm run test:local -- src/domain/javascript/javascriptStaticAnalysis*.test.ts src/domain/javascript/javascriptRpcEndpoints.test.ts src/domain/webBundleAnalyzer.test.ts: 9 files, 116 tests passed
  • npm run verify:test-discovery: discovered all 1184 test files exactly once
  • npm run lint: passed, including module boundaries (1808 source files)
  • npx oxfmt --check src: passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable (static syntax analysis)
  • Package or release metadata impact: none
  • Security, privacy, process, or containment review: no new target interaction

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/3044 **Author:** [@xpeng5278-web](https://github.com/xpeng5278-web) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/browser-request-endpoints` --- ### 📝 Commits (1) - [`aabdcbe`](https://github.com/morluto/rea/commit/aabdcbe4cd9817969f7772ca50f2e792fa74ddaf) fix(javascript): report EventSource and sendBeacon URLs as network endpoints ### 📊 Changes **3 files changed** (+84 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `src/domain/javascript/javascriptStaticAnalysis.event_source.test.ts` (+40 -0) ➕ `src/domain/javascript/javascriptStaticAnalysis.send_beacon.test.ts` (+34 -0) 📝 `src/domain/javascript/javascriptStaticAnalysisHelpers.ts` (+10 -1) </details> ### 📄 Description ## Summary Fixes #3042 Literal `new EventSource(url)` and `navigator.sendBeacon(url, data)` URLs are now reported as `network` endpoints, the same way `WebSocket`, `fetch` and `XMLHttpRequest.open` URLs already are. ## Problem and expected behavior Trigger: `new EventSource("/api/chat/stream")` or `navigator.sendBeacon("/api/telemetry", payload)`. Before this change, `endpointArgument` had no case for either API, so static analysis and web-bundle analysis returned no endpoint for an app's server-sent-event stream or its beacon POST targets. Expected: the literal first argument is reported with mechanism `call:EventSource` / `call:window.EventSource` or `call:navigator.sendBeacon` / `call:window.navigator.sendBeacon`. Dynamic arguments stay unreported. ## Change and scope `endpointArgument` (`src/domain/javascript/javascriptStaticAnalysisHelpers.ts`) now: - treats `EventSource` / `*.EventSource` like `WebSocket` and returns the literal first argument; - returns the literal first argument for `sendBeacon` / `*.sendBeacon`. That helper is the single owner shared by `javascriptStaticAnalysisCalls` and `webBundleAnalyzerInspection`, so both consumers get the fix. Not included: the semantic request IR (`requestMethod` in `javascriptSemanticDataEffects.ts`). Adding methods to its enum would change the tool output schema, so that is left for a separate decision. This is additive next to the `fetch`/`WebSocket` branch that open PR #2878 also edits. If #2878 lands first, the rebase is a trivial merge of the condition. Follow the [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope). Ordinary fix within existing boundaries; maintainer scope decision: not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: `endpointArgument` (static endpoint extraction) - Contribution scope fit and linked maintainer decision: ordinary fix within existing boundaries; not applicable - CLI and MCP/tool-catalog contract: no schema change; additional endpoint findings only - Provider, bridge, target-format, or platform compatibility: none - Evidence, artifact, provenance, or reconstruction contract: none - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none - [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 or updated: `src/domain/javascript/javascriptStaticAnalysis.event_source.test.ts` and `src/domain/javascript/javascriptStaticAnalysis.send_beacon.test.ts`. They cover literal, `window.`-qualified and dynamic-URL cases. - Base reproduction or other evidence: executed. On base 20e4f8309 the two literal-URL tests fail (2 failed, 2 passed) because no EventSource or beacon endpoint is returned. With the fix, all 4 pass. - User-visible CLI/MCP output (if applicable): additional endpoint entries such as `{ kind: "network", value: "/api/chat/stream", mechanism: "call:EventSource" }` and `{ kind: "network", value: "/api/telemetry", mechanism: "call:navigator.sendBeacon" }`. - Remaining proof gaps: no live browser capture run. For evidence-bearing changes: - [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 - `npm run test:local -- src/domain/javascript/javascriptStaticAnalysis*.test.ts src/domain/javascript/javascriptRpcEndpoints.test.ts src/domain/webBundleAnalyzer.test.ts`: 9 files, 116 tests passed - `npm run verify:test-discovery`: discovered all 1184 test files exactly once - `npm run lint`: passed, including module boundaries (1808 source files) - `npx oxfmt --check src`: passed ## Compatibility, safety, and release - Breaking changes or migration steps: none - Real Hopper/Ghidra, browser, or OS coverage: not applicable (static syntax analysis) - Package or release metadata impact: none - Security, privacy, process, or containment review: no new target interaction ## 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:07:42 +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#5576
No description provided.