Skip to content

fix(javascript): report EventSource and sendBeacon URLs as network endpoints - #3044

Merged
morluto merged 1 commit into
morluto:mainfrom
xpeng5278-web:fix/browser-request-endpoints
Oct 14, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
xpeng5278-web:fix/browser-request-endpoints

Conversation

@xpeng5278-web

Copy link
Copy Markdown
Contributor

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 20e4f83 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 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-14T00:07:54.670051Z aabdcbe PR opened
ℹ️ 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 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Adds literal EventSource and sendBeacon URLs to network endpoint findings.

  • EventSource and sendBeacon calls now show their literal URLs as network endpoints.

Reviews (1) · Last reviewed commit: "fix(javascript): report EventSource and ..." · Reviewed by Greptile

@morluto
morluto merged commit bbf0638 into morluto:main Oct 14, 2026
1 check passed
@morluto morluto added bug Something isn't working area: domain Domain logic, errors, and pure functions labels Oct 14, 2026
@morluto

morluto commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Thanks, @xpeng5278-web, for extending endpoint discovery to EventSource and navigator.sendBeacon. Their literal stream and beacon URLs now appear in static analysis. Welcome to REA!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Static analysis omits EventSource and navigator.sendBeacon URLs from network endpoints

2 participants