Skip to content

fix(javascript): keep configuration setting reads out of endpoints - #2402

Merged
morluto merged 4 commits into
morluto:mainfrom
alfredo1491:fix/javascript-configuration-get-endpoints
Oct 13, 2026
Merged

morluto merged 4 commits into
morluto:mainfrom
alfredo1491:fix/javascript-configuration-get-endpoints

Conversation

@alfredo1491

Copy link
Copy Markdown
Contributor

Problem

Static endpoint extraction treats the first literal argument of any *.get(...) call as an HTTP request path unless the receiver is a provable keyed collection (eb68761). VS Code extension bundles read settings through workspace.getConfiguration(section).get(key), so every setting key is reported as a network endpoint.

Running the published [email protected] analyze-javascript-application on the Git extension bundled with VS Code (resources/app/extensions/git) returned 109 network endpoint nodes, nearly all of them setting names such as autofetchPeriod, blame.statusBarItem.enabled, and timeline.date. Static analysis of that extension's dist/main.js alone yields 173 network endpoint findings.

Change

  • classifyParsedJavaScriptOpenReceivers (the single owner of lexical receiver facts) now records a configuration fact for a .get call whose receiver is a getConfiguration(...) call:
    • inline: vscode.workspace.getConfiguration("git").get("autofetch")
    • through a binding whose only visible write is one unconditional initializer: let c = Mt.workspace.getConfiguration("git", uri), l = c.get("timeline.date"). Minifiers emit let here, so the proof uses the recorded writes (semanticStableInitializer) rather than the declaration kind, as tRPC client root resolution already does.
  • endpointArgument skips non-URL literals for that fact, in both application analysis and web bundle analysis (both consume the same facts).
  • Unchanged on purpose: reassigned, conditional, and shadowed receivers; URL/path literals (config.get("/v1/settings")); and other possible base-URL clients such as api.get("users").
  • Cleanup: the receiver fact union was duplicated in three modules; javascriptStaticAnalysisHelpers.ts and javascriptStaticAnalysisState.ts now import JavaScriptOpenReceiverFact.

Measurements

analyzeJavaScriptStaticSource on VS Code's extensions/git/dist/main.js (warm, same host):

before after
network endpoints 173 7
analysis time 2.10 s 2.10 s

The 7 remaining are not provable by this rule and are left untouched: (isTrusted ? getConfiguration(...) : e).get(...) receivers and VS Code Memento reads (globalState.get, workspaceState) — the latter could be a follow-up.

Verification

  • New test keeps configuration setting reads out of endpoints in both analyzers in src/domain/webBundleAnalyzer.test.ts covers positives and the kept cases above for both analyzers.
  • vitest run src/domain/webBundleAnalyzer.test.ts src/domain/javascript/ src/application/javascript/ (rebased on current main): 1415 passed.
  • npm run check:fast (typecheck + lint): passed.
  • Fast projects (domain services adapters composition conformance evaluation) on Windows 11 x64, Node 22.23.1: same 126 pre-existing failures as main on this host (missing locally built Windows native addon, /tmp paths, Windows-invalid file names), +1 passing test.

Unavailable coverage: boundary/acceptance projects and the real CLI run from source were not executed on this host because the Windows native addon cannot be built outside the Linux/MinGW lane; the before/after numbers come from the domain analyzer directly. No real-provider lanes apply.

🤖 Generated with Claude Code

Static endpoint extraction reads the first literal argument of any call
named get as an HTTP request path unless the receiver is a provable keyed
collection. VS Code extension bundles read settings through
`workspace.getConfiguration(section).get(key)`, so every setting key
became a network endpoint: the bundled Git extension's dist/main.js
reported 173 network endpoints, nearly all of them setting names such as
`autofetchPeriod` and `blame.statusBarItem.enabled`.

The lexical receiver classifier now records a `configuration` fact for a
`.get` call whose receiver is a `getConfiguration(...)` call, inline or
through a binding whose only visible write is one unconditional
initializer. Minifiers emit `let` for these bindings, so the proof relies
on the recorded writes rather than the declaration kind, as tRPC client
root resolution already does. Endpoint extraction skips non-URL literals
for that fact in both application and web bundle analysis. Reassigned,
conditional, and shadowed receivers, URL or path literals, and other
clients such as `api.get("users")` keep their endpoints.

The receiver fact union was duplicated in three modules; consumers now
import the classifier's type.

On the Git extension bundle, network endpoints drop from 173 to 7 with
unchanged analysis time (2.1 s).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@baron baron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Source verdict: APPROVE for 24b04f2a7a602666418a8260e25ec9b81508a7b9.

Configuration receiver interpretation stays at the existing shared binding-analysis producer; static endpoint consumers use its fact instead of each reparsing source. The shared named fact type replaces duplicated unions. Stable initializer checks preserve reassignment, conditional and shadowed cases, while explicitly URL-shaped arguments remain endpoint evidence rather than being silently removed.

Focused source and public static CLI validation passed; current-main integration at 653067d799591ce2b8fdc84e99c160ac17e2860f passed typecheck and semantic regressions, including the newer memoization owner. Exact-head hosted Static checks, Test (coverage + timing), and CI required are terminal green after approving the existing unchanged repository CI workflow. No workflow/dependency/install code was changed by this PR.

This is static classification within existing capability scope, not runtime attribution or real-provider verification. Earlier sandbox process-helper failure is not reported as a source pass or a cleanup settlement; validation limits remain separate.

@baron baron added area: domain Domain logic, errors, and pure functions area: tests Test suite and verification bug Something isn't working labels Oct 12, 2026
@matbrgz

matbrgz commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Review Finding & Edge Case

The exclusion of configuration accessor keys from endpoint discovery is well-intentioned, but there is an edge case in isConfigurationAccessorCall:

const isConfigurationAccessorCall = (node: t.Node): boolean =>
  (t.isCallExpression(node) || t.isOptionalCallExpression(node)) &&
  (t.isIdentifier(node.callee)
    ? node.callee.name === "getConfiguration"
    : (t.isMemberExpression(node.callee) ||
        t.isOptionalMemberExpression(node.callee)) &&
      semanticStaticPropertyKey(node.callee.property, node.callee.computed) ===
        "getConfiguration");

Finding

  1. Unscoped getConfiguration matching: When node.callee is a bare identifier (getConfiguration(...)), any user-defined or helper function named getConfiguration() (for example, in an Axios/fetch client wrapper like const api = getConfiguration("/api/v1"); api.get("/users")) will be misclassified as a VS Code workspace configuration accessor.
  2. Missing Endpoint Evidence: If an application defines a custom HTTP client factory named getConfiguration(baseUrl) that returns an Axios instance or HTTP client, legitimate .get("path") endpoints called on its result will be silently filtered out (facts.set(..., "configuration")), resulting in false-negative omissions in endpoints.

Suggested Fix

Tighten the check to verify that member-expression calls originate from known configuration hosts (e.g. workspace.getConfiguration or vscode.workspace.getConfiguration) rather than matching any standalone function whose identifier happens to be getConfiguration.

A bare or differently scoped `getConfiguration(...)` may be an
application's own HTTP client factory, so `.get("users")` on its result
lost its endpoint. Only `workspace.getConfiguration(...)` and
`<x>.workspace.getConfiguration(...)` now produce the configuration fact.
Minifiers keep property names, so the bundled VS Code Git extension still
reports 7 network endpoints instead of 173.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alfredo1491

Copy link
Copy Markdown
Contributor Author

@matbrgz Thanks, good catch on the scoping. One correction: api.get("/users") was never dropped — URL- and path-shaped literals (/, ./, ../, http(s)://, ws(s)://) always remain endpoints. The real gap was a non-path key such as api.get("users") on a client returned by an unrelated getConfiguration(...).

Fixed in 67123bf: the configuration fact now requires workspace.getConfiguration(...) or <x>.workspace.getConfiguration(...). Bare and differently scoped getConfiguration calls no longer qualify. Your cases are in the test (client.get("accounts") after getConfiguration("/api/v1"), and http.getConfiguration(baseUrl).get("orders")). Minifiers keep property names, so the bundled VS Code Git extension still reports 7 network endpoints instead of 173. JavaScript suites (1415 tests) and check:fast pass.

@baron baron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Merge gate: HELD at 67123bf5debab3ddbb83f0c8bd1f832c9efc6965.

The head moved from the previously approved24b04f2 while merging. I reviewed the two-file update narrowing configuration recognition to workspace.getConfiguration and preserving application HTTP factories. Fresh integration with main c462a4e passed typecheck and171 focused semantic/web-bundle/artifact-path regressions.

However, the newly approved exact-head CI run38325817119 is red: shard4/6 fails three GhidraInstallation.test.ts native-decompiler admission assertions (lines619, accepted-header explanation case, and709). Required Test (coverage + timing) and CI required consequently fail. The assertions are outside this JavaScript update; attribution to this PR versus its baseline/integration is not established. Passing focused tests cannot override these failed mandatory gates. No merge, timeout/assertion weakening or rerun-to-hide-failure was performed.

CI: https://github.com/morluto/rea/actions/runs/38325817119

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@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; the default-import fix leaves no blocking finding.

Summary

The PR keeps VS Code configuration keys out of endpoint results in both analyzers. The latest change adds default-import support and a matching parity test.

  • VS Code setting reads no longer show up as network endpoints.

Reviews (3) · Last reviewed commit: "fix(javascript): recognize default VS Co..." · Reviewed by Greptile

@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

Configuration recognition previously depended only on workspace spelling. The classifier now consults lexical bindings and known vscode import/require origins; a locally declared unrelated workspace or namespace keeps its endpoint candidates. Both analyzer parity cases were extended.

Current source: f3397e0. Validation: source inspection only; tests and checks were skipped at the user's explicit request.

  1. thread 1

The lexical proof now accepts a single default namespace import from vscode in addition to namespace and require forms. A default-import case was added to the existing two-analyzer parity fixture; unrelated local workspace/namespace objects still retain endpoint candidates.

Current source: f3397e0. Validation: source inspection only; tests and checks were skipped at the user's explicit request.

@morluto
morluto merged commit 23f7214 into morluto:main Oct 13, 2026
1 check passed
coleleavitt added a commit to coleleavitt/rea that referenced this pull request Oct 13, 2026
The configuration-read parity test from main (morluto#2402) compared every static
analysis endpoint with the web bundle analyzer. This branch (2cf4d02)
deliberately reports URL-like strings that no request consumes as data
endpoints, so the path-like getConfiguration("/api") arguments now appear
with kind "data". The web bundle analyzer does not report data values. The
assertion now ignores data endpoints, as the neighbouring parity tests on this
branch already do; the configuration get keys are still not endpoints.
@morluto morluto added the area: setup Setup, packaging, upgrade, install, Doctor, and client registration 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 area: setup Setup, packaging, upgrade, install, Doctor, and client registration area: tests Test suite and verification bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants