Skip to content

fix: preserve navigation, network, and control-transfer uncertainty - #8695

Open
scaroll wants to merge 36 commits into
morluto:mainfrom
scaroll:main
Open

scaroll wants to merge 36 commits into
morluto:mainfrom
scaroll:main

Conversation

@scaroll

@scaroll scaroll commented Nov 2, 2026 •

Copy link
Copy Markdown

Summary

This PR is a batch of fixes that keep uncertainty visible in REA's JavaScript route and network recovery and in Ghidra control-transfer reporting. Before these fixes, several analyzer paths dropped calls or reported them as certain when the target, timing, or identity could not be established. Examples are navigation or network calls made before a global was replaced, XHR/fetch targets built from dynamic values, and Ghidra transfers whose targets are computed, conditional, external, or unrepresented. With these fixes, REA either recovers the call or reports it with explicit uncertainty or incomplete coverage.

This PR is opened as a draft. It bundles 34 commits (36 files, +3016/−95), merged with current main. If maintainers want it split into focused PRs by area (JavaScript navigation, web/network, Ghidra), I can do that.

Problem and expected behavior

  • JavaScript navigation: recovers location, location.href, location.assign, document location, and history navigation. It also keeps the navigation timing, plus the navigation identity and its uncertainty, when globals are replaced or written dynamically.
  • Web/network: keeps fetch, XHR and other browser network calls that happen before a method is replaced. It also keeps uncertainty about targets, identity and coverage. It recovers bounded or direct URL request targets and qualified destinations, and excludes methods that were replaced.
  • Ghidra: reports when transfer information is incomplete: computed targets, conditional external transfers, uncertain tail transfers, and unrepresented incoming jumps. It also points missing symbols to the name inventory and gives guidance for recovering from an unknown procedure.
  • MCP: describes the accepted JavaScript input formats.
  • Tests: isolate the home directories used by CLI acceptance and compile-cache tests.

Change and scope

These are ordinary fixes within existing analyzer and provider boundaries. They add no new provider and no capability for target execution, injection, mutation, or protection recovery. Maintainer scope decision: not applicable.

Commits (34, oldest last)
  • 437b97f37 fix(ghidra): disclose unrepresented incoming jumps
  • 53bfcaefe fix(javascript): preserve location navigation timing
  • 01786f2bf fix(web): resolve direct url request targets
  • c80ebf63a fix(ghidra): disclose incomplete computed targets
  • e1dbb87d8 fix(javascript): preserve request argument uncertainty
  • f417984f5 fix(web): recover bounded request targets and uncertainty
  • 2603ca80a fix(ghidra): disclose conditional external transfers
  • 89b85bae2 fix(ghidra): disclose uncertain tail transfers
  • 86d4eb942 fix(javascript): report compound location writes
  • a62c91046 fix(javascript): recover document location navigation
  • 01db963fb fix(web): recover qualified browser network destinations
  • dd35aeb05 fix(web): exclude replaced browser network methods
  • dbb56355b fix(web): report uncertain browser network identity
  • e25d78d3f fix(web): retain unknown legacy xhr coverage
  • 015797b9a fix(web): preserve uncertain XHR coverage
  • 6ab6bde72 fix(javascript): preserve xhr timing and uncertainty
  • ef56cb3de fix(javascript): model navigation api identity
  • 620244be8 fix(javascript): exclude replaced qualified network calls
  • 8396834c7 fix(javascript): recover history calls before replacement
  • b920a0117 fix(javascript): preserve navigation identity uncertainty
  • 8a1b0fafe fix(javascript): preserve network calls before replacement
  • 99b5075db fix(javascript): preserve uncertainty after dynamic global writes
  • e00bde260 fix(javascript): preserve fetch calls before global replacement
  • 71121b66c fix(javascript): recover browser location property routes
  • 503101799 fix(javascript): recover direct location navigation
  • 4b235d5ba fix(javascript): detect location href navigation
  • 0a7c25e00 test(javascript): isolate route cli acceptance homes
  • aba8e278f fix(javascript): recover location assign destinations
  • d72fcd9e6 test(cli): isolate compile cache test homes
  • b1570c67a test(javascript): isolate cli acceptance home
  • 27331cd8f fix(javascript): recover browser history navigation routes
  • aa7428a7d fix(ghidra): direct missing symbols to name inventory
  • d7282e636 fix(mcp): describe javascript input formats
  • e07106d34 fix(ghidra): guide recovery from unknown procedure

Contract and boundary impact

  • Semantic owner and earliest changed stage: the JavaScript route/network scan in src/domain/javascript/, the web bundle analyzer, and the Ghidra provider/bridge transfer reporting. Unknown: a per-commit consumer audit is not summarized here.
  • Contribution scope fit and linked maintainer decision: not applicable (fixes within existing boundaries).
  • CLI and MCP/tool-catalog contract: the MCP description of JavaScript input formats changed. Other output adds uncertainty and coverage details. Unknown: whether any field is renamed.
  • Provider, bridge, target-format, or platform compatibility: the Ghidra bridge (ReaGhidraBridge.java) and the provider changed.
  • Evidence, artifact, provenance, or reconstruction contract: intended to keep uncertainty and partial facts rather than drop them.
  • Generated metadata, package, or installation impact: no build outputs committed.

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 or updated: regression tests come with the fixes, including src/domain/webBundleAnalyzer.test.ts, src/ghidra/GhidraProvider.behavior.test.ts, and the JavaScript route scan tests.
  • Base reproduction or other evidence: not reproduced against the base in this PR body. Proof gap.
  • Remaining proof gaps: the full test suite has not completed on this head. Real Ghidra coverage is not recorded.

Validation performed

  • npm run typecheck on merge commit 6d4f5ad56: passed.
  • npx vitest run src/domain/webBundleAnalyzer.test.ts src/ghidra/GhidraProvider.behavior.test.ts on 6d4f5ad56: 331/331 passed.
  • Full npm test on 437b97f37: still running, no result yet. That run also includes uncommitted local edits, so it would not be clean evidence for this head anyway. CI on this PR is the authoritative check.

Compatibility, safety, and release

  • Breaking changes or migration steps: none intended. Unknown: no compatibility audit.
  • Real Hopper/Ghidra, browser, or OS coverage: not recorded.
  • Package or release metadata impact: none intended.
  • Security, privacy, process, or containment review: no new target interaction.

Author readiness

Human owner: @scaroll

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

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.

🤖 Generated with Claude Code

scaroll and others added 30 commits November 2, 2026 10:06
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@scaroll
scaroll marked this pull request as ready for review November 2, 2026 16:49
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 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-11-02T19:46:08.496958Z 18efec4 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.

@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: 437b97f37d

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

Comment on lines +170 to +174
(isUnmodifiedGlobalReference(node.left.object, index.bindings, "location") ||
isUnmodifiedGlobalReference(node.left.object, index.bindings, [
"document",
"location",
]));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve timed identity for Location property writes

For globalThis[key] = custom; location.href = '/maybe';, this whole-source identity check returns false, and inspect has no unresolved-navigation fallback for ordinary = property writes. The potentially valid navigation therefore disappears instead of retaining uncertainty. The same predicate also drops a definitely earlier setter when the dynamic global write occurs later. Use the retained timed location/document.location readers here, as the method and direct-assignment branches do, and preserve an unknown result when receiver identity cannot be established.

AGENTS.md reference: AGENTS.md:L21-L21

Useful? React with 👍 / 👎.

"Spread arguments leave the History API destination unknown.",
);
} else if (url !== undefined && !t.isArgumentPlaceholder(url)) {
this.#navigation(url);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Separate native URL arguments from router pathname records

For history.pushState(null, '', {pathname: '/invented'}), the new branch passes the value to #navigation, whose router-record handling emits /invented. Browser History and Location APIs instead stringify this object to [object Object]; they do not interpret its pathname field as the destination. The same problem affects the newly added location.assign(...) and location.href = ... paths. Keep pathname-record interpretation limited to router APIs and retain an unresolved native destination when its URL string cannot be established.

AGENTS.md reference: AGENTS.md:L27-L27

Useful? React with 👍 / 👎.

try {
await promisify(execFile)(
process.env.REA_CC ?? "cc",
["-O1", source, "-o", binary],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Ensure the native fixture actually contains tail jumps

With the default Linux x86-64/GCC toolchain, these flags do not generate the tail transfer required by verifyGhidraTailBoundaries: cc -Q -O1 --help=optimizers reports -foptimize-sibling-calls [disabled], and compiling/disassembling this exact fixture with GCC 13 produced call *%rax followed by ret in rea_tail_indirect. Consequently, the helper's unconditional targetless computed jump(s) and empty unresolved_calls assertions reject correct Ghidra output on that supported host. Explicitly enable and verify tail-call generation, or use a fixed assembly fixture.

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 0/5 Tier: apex

[High impact] The PR changes analysis findings across JavaScript routes, browser network evidence, and Ghidra reports.

Do not merge yet; response capture can expose secret-bearing digests and change retained response text.

Findings

  1. P1 Security Redacted secrets remain guessable ▶
  2. P1 Saved response text changes ▶
  3. P1 Rejected bodies still allocate ▶
  4. P1 Early navigation disappears ▶
  5. P1 Document replacement loses uncertainty ▶
  6. P1 Browser calls invent routes ▶
  7. P1 Dynamic XHR loses identity uncertainty ▶
  8. P1 URL recovery reports wrong destinations ▶
  9. P1 Internal switches block matching ▶
  10. P1 GCC breaks Ghidra verification ▶
  11. P2 Transfer warnings vanish between views ▶
  12. P2 Every analysis restarts the CLI ▶
  13. P2 Wording edits break checks ▶
Fix with agent prompt
### Issue 1
src/browser/network/CharsetlessTextBody.ts:89
`observed_sha256` hashes the response before secret redaction and remains beside the redacted body. For recoverable text such as `é PIN=1234`, a reader can try four-digit PINs, recreate the exposed bytes, and match this digest. The final privacy pass is skipped when only declared secrets exist, so it does not remove the hash.

Do not publish a digest of bytes containing protected values. `AGENTS.md` requires protecting explicitly marked sensitive values.

**How this was verified:** The original response is hashed before `redactBytes`, and captures with declared secrets only keep that hash alongside the redacted content.

### Issue 2
src/browser/network/PlaywrightNetworkContent.ts:169-175
Recovery now runs inside `captureNetworkBody`, but `PlaywrightScenarioEvents.protectNetworkEvent` calls that function again on `prior.content` after a response value is saved as secret. That second pass can:

- Change a body correctly recovered to literal `é` into `é`.
- Drop `text_decoding` from an ordinary recovered `é` body.

These are already-retained bytes, not another Playwright read. Apply recovery once at the producer boundary and preserve its safe metadata during later secret scrubbing. `AGENTS.md` requires one owner for interpretation and preservation of source evidence.

### Issue 3
src/browser/network/PlaywrightNetworkContent.ts:169-172
`recoverCharsetlessUtf8` runs before the allocation limit and `preflight` checks. It decodes full strings and allocates buffers even when those checks reject the body. The byte limit is independent, so callers can admit a large response read while keeping a small allocation budget.

Admit the recovery cost before making these copies. `docs/tool-design.md` requires enforcing resource budgets before the costly step.

### Issue 4
src/domain/javascript/javascriptRouteScan.ts:170-174
`locationPropertyWrite` checks writes across the whole source. In `location.href='/early'; window.location=custom;`, the later assignment rejects the earlier property write. It then bypasses the new assignment branches, so `/early` disappears. Conditional replacements likewise lose the property write's identity uncertainty.

Use the timed readers for property writes too. The repository requires preserving uncertainty rather than silently dropping it.

### Issue 5
src/domain/javascript/javascriptRouteScan.ts:872-878
`document.location.replace` is missing from this list, although `#locationMethodStatus` recognizes it. After `eval(code); document.location.replace('/candidate')`, the reader still returns `unmodified`. The scanner emits a navigation target without the identity unknown produced for `document.location.assign`.

Put the opaque-effect check in the shared method-status query so supported spellings cannot diverge. The repository requires preserving uncertainty at its owner.

### Issue 6
src/domain/javascript/javascriptRouteScan.ts:971-972
The new browser API branches pass destinations to `#navigation`, which also accepts router-style objects. For example, `history.pushState(null, '', {pathname:'/wrong'})` now reports `/wrong`. The browser converts that object to a string; it does not read its `pathname` field.

Keep browser URL arguments separate from router objects and leave unsupported conversions unknown. The repository requires preserving source meaning across these boundaries.

### Issue 7
src/domain/javascript/javascriptStaticAnalysisCalls.ts:641-642
With `XMLHttpRequest.prototype.open=custom; new XMLHttpRequest().open('GET', target)`, this branch calls `addPartialNetworkEndpoint` without `interpretation: 'candidate'`. The graph therefore records a normal network endpoint. `resolution: 'partial'` only explains the unresolved URL, not whether the method is a network API.

Carry both flags through the partial helper. The repository requires preserving identity uncertainty across boundaries.

### Issue 8
src/domain/javascript/javascriptStaticAnalysisCalls.ts:759-760
For `patch(URL.prototype); fetch(new URL('https://example.test/original'))`, the shared index records that `patch` may change the prototype. The new direct-URL path ignores that fact because `literalUrlObjectTarget` checks only explicit writes. If `patch` changes `toString`, the request uses the changed string while the analyzer reports the original `href`.

Check prototype escapes as well as writes before confirming direct or aliased URL targets. This preserves uncertainty as required by the repository.

### Issue 9
bridge/ghidra/ReaGhidraBridge.java:3680-3683
Every computed jump with a known destination now makes callee coverage partial, even an internal switch whose observed call rows are all returned. The added internal-switch check requires this result. Native matching then rejects otherwise usable function evidence.

`docs/tool-design.md` requires `relationship_coverage` to describe the provider-observed direct set; possible runtime edges must remain separate caveats. Keep this warning outside the incomplete-set status unless an observed relationship is actually missing.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

### Issue 10
scripts/lib/real-ghidra-tail-boundaries.mjs:undefined-24
Compiling this fixture with `-O1` does not produce the required tail jump on GCC. Debian GCC 12.2 emits `call *%rax` followed by a return for `rea_tail_indirect`; at `-O2` it emits `jmp *%rax`. The assertions below require a targetless computed jump and an empty `unresolved_calls`, so the real Ghidra verifier fails on the supported Linux GCC path.

Enable sibling-call optimization explicitly and check that the fixture contains the intended transfer.

### Issue 11
bridge/ghidra/ReaGhidraBridge.java:3760-3766
Jump facts are collected only in `callBoundaryObservation`, not in `FunctionBoundaryLimitations.observe`. Plain function views therefore leave all four new counters at zero. Also, `values()` emits only two counters, so outgoing `procedure_references` loses the known-computed and conditional-external warnings.

The repository requires preserving uncertainty through a shared owner. Move collection and warning construction there so each view keeps the relevant facts. This requirement must be met before merging.

### Issue 12
tests/support/cli/javascriptApplication.ts:59-60
Creating a fresh `HOME` on every helper call defeats `cli.sharedCliRun`: its owner retires the process whenever the environment changes. Files with repeated analyses now pay CLI startup for every call.

Allocate the isolated home with the file-scoped session and reuse it. The repository requires reusing shared work and removing repeated test setup; that requirement must be met before merging.

### Issue 13
src/contracts/javascriptRouteDeliveryContracts.test.ts:27-29
This test freezes the entire description sentence instead of checking the advertised formats and default. The new Ghidra recovery assertion similarly freezes a full guidance sentence. Harmless wording edits therefore fail contract and real-provider checks without changing behavior.

`docs/testing.md` requires checking facts and recovery behavior rather than explanatory wording. Assert the enum/default and named recovery operation instead. This repository requirement must be met before merging.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR adds timing-aware JavaScript navigation and network scans, plus Ghidra transfer caveats. The latest change also tries to recover charset-less response text.

  • JavaScript analysis recognizes browser navigation and keeps uncertain routes visible.
  • JavaScript analysis keeps supported network requests and reports unresolved targets as uncertain.
  • Browser capture recovers UTF-8 bytes from certain charset-less text bodies.
  • Ghidra reports when control-transfer coverage is incomplete.
  • JavaScript application guidance names the accepted input formats.
  • CLI tests use isolated home directories for their runs.

Diagram

sequenceDiagram
  participant P as Playwright
  participant C as captureNetworkBody
  participant R as Text recovery
  participant S as Secret scrubbing
  participant E as Saved events
  P->>C: Response bytes
  C->>R: Try recovery
  R-->>C: Recovered bytes and original digest
  C->>S: Remove marked values
  C->>E: Save body and decoding facts
  opt A response value was saved as secret
    E->>C: Read retained content again
    C->>R: Run recovery again
    C->>E: Replace saved body
  end
Loading

Reviews (2) · Last reviewed commit: "fix(browser): recover UTF-8 bytes of cha..." · Reviewed by Greptile

Comment on lines +170 to +174
(isUnmodifiedGlobalReference(node.left.object, index.bindings, "location") ||
isUnmodifiedGlobalReference(node.left.object, index.bindings, [
"document",
"location",
]));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Early navigation disappears

locationPropertyWrite checks writes across the whole source. In location.href='/early'; window.location=custom;, the later assignment rejects the earlier property write. It then bypasses the new assignment branches, so /early disappears. Conditional replacements likewise lose the property write's identity uncertainty.

Use the timed readers for property writes too. The repository requires preserving uncertainty rather than silently dropping it.

Context Used: AGENTS.md (source)

Knowledge Base Used: Artifact and application analysis

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/javascriptRouteScan.ts
Line: 170-174

Comment:
**Early navigation disappears**

`locationPropertyWrite` checks writes across the whole source. In `location.href='/early'; window.location=custom;`, the later assignment rejects the earlier property write. It then bypasses the new assignment branches, so `/early` disappears. Conditional replacements likewise lose the property write's identity uncertainty.

Use the timed readers for property writes too. The repository requires preserving uncertainty rather than silently dropping it.

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

**Knowledge Base Used:** [Artifact and application analysis](https://app.greptile.com/-/switch-tenant?tenant=pre&next=%2Fcustom-context%2Fknowledge-base%2Fmorluto%2Frea%2F-%2Fdocs%2Fartifact-and-application-analysis.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +872 to +878
[
["history", "pushState"],
["history", "replaceState"],
["location", "assign"],
["location", "replace"],
["document", "location", "assign"],
["navigation", "navigate"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Document replacement loses uncertainty

document.location.replace is missing from this list, although #locationMethodStatus recognizes it. After eval(code); document.location.replace('/candidate'), the reader still returns unmodified. The scanner emits a navigation target without the identity unknown produced for document.location.assign.

Put the opaque-effect check in the shared method-status query so supported spellings cannot diverge. The repository requires preserving uncertainty at its owner.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/javascriptRouteScan.ts
Line: 872-878

Comment:
**Document replacement loses uncertainty**

`document.location.replace` is missing from this list, although `#locationMethodStatus` recognizes it. After `eval(code); document.location.replace('/candidate')`, the reader still returns `unmodified`. The scanner emits a navigation target without the identity unknown produced for `document.location.assign`.

Put the opaque-effect check in the shared method-status query so supported spellings cannot diverge. The repository requires preserving uncertainty at its owner.

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +971 to +972
} else if (url !== undefined && !t.isArgumentPlaceholder(url)) {
this.#navigation(url);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Browser calls invent routes

The new browser API branches pass destinations to #navigation, which also accepts router-style objects. For example, history.pushState(null, '', {pathname:'/wrong'}) now reports /wrong. The browser converts that object to a string; it does not read its pathname field.

Keep browser URL arguments separate from router objects and leave unsupported conversions unknown. The repository requires preserving source meaning across these boundaries.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/javascriptRouteScan.ts
Line: 971-972

Comment:
**Browser calls invent routes**

The new browser API branches pass destinations to `#navigation`, which also accepts router-style objects. For example, `history.pushState(null, '', {pathname:'/wrong'})` now reports `/wrong`. The browser converts that object to a string; it does not read its `pathname` field.

Keep browser URL arguments separate from router objects and leave unsupported conversions unknown. The repository requires preserving source meaning across these boundaries.

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +641 to +642
if (value === undefined) {
addPartialNetworkEndpoint(context, node, name, target);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Dynamic XHR loses identity uncertainty

With XMLHttpRequest.prototype.open=custom; new XMLHttpRequest().open('GET', target), this branch calls addPartialNetworkEndpoint without interpretation: 'candidate'. The graph therefore records a normal network endpoint. resolution: 'partial' only explains the unresolved URL, not whether the method is a network API.

Carry both flags through the partial helper. The repository requires preserving identity uncertainty across boundaries.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/javascriptStaticAnalysisCalls.ts
Line: 641-642

Comment:
**Dynamic XHR loses identity uncertainty**

With `XMLHttpRequest.prototype.open=custom; new XMLHttpRequest().open('GET', target)`, this branch calls `addPartialNetworkEndpoint` without `interpretation: 'candidate'`. The graph therefore records a normal network endpoint. `resolution: 'partial'` only explains the unresolved URL, not whether the method is a network API.

Carry both flags through the partial helper. The repository requires preserving identity uncertainty across boundaries.

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +759 to +760
if (t.isNewExpression(direct))
return literalUrlObjectTarget(direct, bindings);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 URL recovery reports wrong destinations

For patch(URL.prototype); fetch(new URL('https://example.test/original')), the shared index records that patch may change the prototype. The new direct-URL path ignores that fact because literalUrlObjectTarget checks only explicit writes. If patch changes toString, the request uses the changed string while the analyzer reports the original href.

Check prototype escapes as well as writes before confirming direct or aliased URL targets. This preserves uncertainty as required by the repository.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/javascriptStaticAnalysisCalls.ts
Line: 759-760

Comment:
**URL recovery reports wrong destinations**

For `patch(URL.prototype); fetch(new URL('https://example.test/original'))`, the shared index records that `patch` may change the prototype. The new direct-URL path ignores that fact because `literalUrlObjectTarget` checks only explicit writes. If `patch` changes `toString`, the request uses the changed string while the analyzer reports the original `href`.

Check prototype escapes as well as writes before confirming direct or aliased URL targets. This preserves uncertainty as required by the repository.

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +3680 to +3683
if (calls != null && calls.computedJumpsWithKnownDestinations() > 0) {
limitations.add("Ghidra decoded " + calls.computedJumpsWithKnownDestinations() +
" computed jump(s) with known destinations; their exhaustive destination coverage and possible transfers to other functions remain unknown.");
if (!directions.contains(new com.google.gson.JsonPrimitive("callees"))) directions.add("callees");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Internal switches block matching

Every computed jump with a known destination now makes callee coverage partial, even an internal switch whose observed call rows are all returned. The added internal-switch check requires this result. Native matching then rejects otherwise usable function evidence.

docs/tool-design.md requires relationship_coverage to describe the provider-observed direct set; possible runtime edges must remain separate caveats. Keep this warning outside the incomplete-set status unless an observed relationship is actually missing.

Context Used: Documentation (source)

Knowledge Base Used: Ghidra integration

Prompt To Fix With AI
This is a comment left during a code review.
Path: bridge/ghidra/ReaGhidraBridge.java
Line: 3680-3683

Comment:
**Internal switches block matching**

Every computed jump with a known destination now makes callee coverage partial, even an internal switch whose observed call rows are all returned. The added internal-switch check requires this result. Native matching then rejects otherwise usable function evidence.

`docs/tool-design.md` requires `relationship_coverage` to describe the provider-observed direct set; possible runtime edges must remain separate caveats. Keep this warning outside the incomplete-set status unless an observed relationship is actually missing.

**Context Used:** Documentation ([source](https://github.com/morluto/rea/blob/main/docs))

**Knowledge Base Used:** [Ghidra integration](https://app.greptile.com/-/switch-tenant?tenant=pre&next=%2Fcustom-context%2Fknowledge-base%2Fmorluto%2Frea%2F-%2Fdocs%2Fghidra-integration.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +3760 to +3766
if (instruction.getFlowType().isJump() && instruction.getFlowType().isComputed() &&
instruction.getFlows().length == 0) {
boundary.unresolvedComputedJumps++;
}
if (instruction.getFlowType().isJump() && instruction.getFlowType().isComputed() &&
instruction.getFlows().length > 0) {
boundary.computedJumpsWithKnownDestinations++;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Transfer warnings vanish between views

Jump facts are collected only in callBoundaryObservation, not in FunctionBoundaryLimitations.observe. Plain function views therefore leave all four new counters at zero. Also, values() emits only two counters, so outgoing procedure_references loses the known-computed and conditional-external warnings.

The repository requires preserving uncertainty through a shared owner. Move collection and warning construction there so each view keeps the relevant facts. This requirement must be met before merging.

Context Used: AGENTS.md (source)

Knowledge Base Used: Ghidra integration

Prompt To Fix With AI
This is a comment left during a code review.
Path: bridge/ghidra/ReaGhidraBridge.java
Line: 3760-3766

Comment:
**Transfer warnings vanish between views**

Jump facts are collected only in `callBoundaryObservation`, not in `FunctionBoundaryLimitations.observe`. Plain function views therefore leave all four new counters at zero. Also, `values()` emits only two counters, so outgoing `procedure_references` loses the known-computed and conditional-external warnings.

The repository requires preserving uncertainty through a shared owner. Move collection and warning construction there so each view keeps the relevant facts. This requirement must be met before merging.

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

**Knowledge Base Used:** [Ghidra integration](https://app.greptile.com/-/switch-tenant?tenant=pre&next=%2Fcustom-context%2Fknowledge-base%2Fmorluto%2Frea%2F-%2Fdocs%2Fghidra-integration.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

try {
await promisify(execFile)(
process.env.REA_CC ?? "cc",
["-O1", source, "-o", binary],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 GCC breaks Ghidra verification

Compiling this fixture with -O1 does not produce the required tail jump on GCC. Debian GCC 12.2 emits call *%rax followed by a return for rea_tail_indirect; at -O2 it emits jmp *%rax. The assertions below require a targetless computed jump and an empty unresolved_calls, so the real Ghidra verifier fails on the supported Linux GCC path.

Enable sibling-call optimization explicitly and check that the fixture contains the intended transfer.

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/lib/real-ghidra-tail-boundaries.mjs
Line: 24

Comment:
**GCC breaks Ghidra verification**

Compiling this fixture with `-O1` does not produce the required tail jump on GCC. Debian GCC 12.2 emits `call *%rax` followed by a return for `rea_tail_indirect`; at `-O2` it emits `jmp *%rax`. The assertions below require a targetless computed jump and an empty `unresolved_calls`, so the real Ghidra verifier fails on the supported Linux GCC path.

Enable sibling-call optimization explicitly and check that the fixture contains the intended transfer.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines 59 to +60
const run = cli.sharedCliRun ?? ((invocation) => cli.run(invocation));
const home = await createTestTempDirectory("rea-javascript-cli-home-");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Every analysis restarts the CLI

Creating a fresh HOME on every helper call defeats cli.sharedCliRun: its owner retires the process whenever the environment changes. Files with repeated analyses now pay CLI startup for every call.

Allocate the isolated home with the file-scoped session and reuse it. The repository requires reusing shared work and removing repeated test setup; that requirement must be met before merging.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/support/cli/javascriptApplication.ts
Line: 59-60

Comment:
**Every analysis restarts the CLI**

Creating a fresh `HOME` on every helper call defeats `cli.sharedCliRun`: its owner retires the process whenever the environment changes. Files with repeated analyses now pay CLI startup for every call.

Allocate the isolated home with the file-scoped session and reuse it. The repository requires reusing shared work and removing repeated test setup; that requirement must be met before merging.

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +27 to +29
expect(JSON.stringify(projected)).toContain(
"Input format: auto (default), asar, or directory.",
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Wording edits break checks

This test freezes the entire description sentence instead of checking the advertised formats and default. The new Ghidra recovery assertion similarly freezes a full guidance sentence. Harmless wording edits therefore fail contract and real-provider checks without changing behavior.

docs/testing.md requires checking facts and recovery behavior rather than explanatory wording. Assert the enum/default and named recovery operation instead. This repository requirement must be met before merging.

Context Used: Documentation (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/contracts/javascriptRouteDeliveryContracts.test.ts
Line: 27-29

Comment:
**Wording edits break checks**

This test freezes the entire description sentence instead of checking the advertised formats and default. The new Ghidra recovery assertion similarly freezes a full guidance sentence. Harmless wording edits therefore fail contract and real-provider checks without changing behavior.

`docs/testing.md` requires checking facts and recovery behavior rather than explanatory wording. Assert the enum/default and named recovery operation instead. This repository requirement must be met before merging.

**Context Used:** Documentation ([source](https://github.com/morluto/rea/blob/main/docs))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Chromium DevTools returns charset-less text/* as a windows-1252 fallback
decode and Playwright re-encodes it as UTF-8, inflating multi-byte UTF-8
(Next.js text/markdown: 20,044 bytes vs 19,919 on the wire). Invert the
decode before redaction and hashing when the inverse is valid UTF-8, and
record declared_charset null, decoded_as utf-8, method and the observed
byte count and sha256 in text_decoding. Declared charsets, HTML and
non-text bodies are unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
decoded_as: "utf-8",
method: "reversed-windows-1252-decode",
observed_bytes: observed.length,
observed_sha256: createHash("sha256").update(observed).digest("hex"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 security Redacted secrets remain guessable

observed_sha256 hashes the response before secret redaction and remains beside the redacted body. For recoverable text such as é PIN=1234, a reader can try four-digit PINs, recreate the exposed bytes, and match this digest. The final privacy pass is skipped when only declared secrets exist, so it does not remove the hash.

Do not publish a digest of bytes containing protected values. AGENTS.md requires protecting explicitly marked sensitive values.

How this was verified: The original response is hashed before redactBytes, and captures with declared secrets only keep that hash alongside the redacted content.

Context Used: AGENTS.md (source)

Knowledge Base Used: Browser network capture

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/browser/network/CharsetlessTextBody.ts
Line: 89

Comment:
**Redacted secrets remain guessable**

`observed_sha256` hashes the response before secret redaction and remains beside the redacted body. For recoverable text such as `é PIN=1234`, a reader can try four-digit PINs, recreate the exposed bytes, and match this digest. The final privacy pass is skipped when only declared secrets exist, so it does not remove the hash.

Do not publish a digest of bytes containing protected values. `AGENTS.md` requires protecting explicitly marked sensitive values.

**How this was verified:** The original response is hashed before `redactBytes`, and captures with declared secrets only keep that hash alongside the redacted content.

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

**Knowledge Base Used:** [Browser network capture](https://app.greptile.com/-/switch-tenant?tenant=pre&next=%2Fcustom-context%2Fknowledge-base%2Fmorluto%2Frea%2F-%2Fdocs%2Fbrowser-network-capture.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +169 to +175
const recovered =
phase === "response"
? recoverCharsetlessUtf8(exposed, contentType)
: undefined;
const observed = recovered?.bytes ?? exposed;
const textDecoding: CharsetlessTextRecovery | undefined =
recovered?.recovery;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Saved response text changes

Recovery now runs inside captureNetworkBody, but PlaywrightScenarioEvents.protectNetworkEvent calls that function again on prior.content after a response value is saved as secret. That second pass can:

  • Change a body correctly recovered to literal é into é.
  • Drop text_decoding from an ordinary recovered é body.

These are already-retained bytes, not another Playwright read. Apply recovery once at the producer boundary and preserve its safe metadata during later secret scrubbing. AGENTS.md requires one owner for interpretation and preservation of source evidence.

Context Used: AGENTS.md (source)

Knowledge Base Used: Browser network capture

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/browser/network/PlaywrightNetworkContent.ts
Line: 169-175

Comment:
**Saved response text changes**

Recovery now runs inside `captureNetworkBody`, but `PlaywrightScenarioEvents.protectNetworkEvent` calls that function again on `prior.content` after a response value is saved as secret. That second pass can:

- Change a body correctly recovered to literal `é` into `é`.
- Drop `text_decoding` from an ordinary recovered `é` body.

These are already-retained bytes, not another Playwright read. Apply recovery once at the producer boundary and preserve its safe metadata during later secret scrubbing. `AGENTS.md` requires one owner for interpretation and preservation of source evidence.

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

**Knowledge Base Used:** [Browser network capture](https://app.greptile.com/-/switch-tenant?tenant=pre&next=%2Fcustom-context%2Fknowledge-base%2Fmorluto%2Frea%2F-%2Fdocs%2Fbrowser-network-capture.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +169 to +172
const recovered =
phase === "response"
? recoverCharsetlessUtf8(exposed, contentType)
: undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Rejected bodies still allocate

recoverCharsetlessUtf8 runs before the allocation limit and preflight checks. It decodes full strings and allocates buffers even when those checks reject the body. The byte limit is independent, so callers can admit a large response read while keeping a small allocation budget.

Admit the recovery cost before making these copies. docs/tool-design.md requires enforcing resource budgets before the costly step.

Context Used: Documentation (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/browser/network/PlaywrightNetworkContent.ts
Line: 169-172

Comment:
**Rejected bodies still allocate**

`recoverCharsetlessUtf8` runs before the allocation limit and `preflight` checks. It decodes full strings and allocates buffers even when those checks reject the body. The byte limit is independent, so callers can admit a large response read while keeping a small allocation budget.

Admit the recovery cost before making these copies. `docs/tool-design.md` requires enforcing resource budgets before the costly step.

**Context Used:** Documentation ([source](https://github.com/morluto/rea/blob/main/docs))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@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: 18efec4ce2

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

Comment on lines +170 to +172
phase === "response"
? recoverCharsetlessUtf8(exposed, contentType)
: undefined;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Apply charset recovery only to original producer bytes

When response secrets have been learned, PlaywrightScenarioEvents.protectNetworkEvent calls captureNetworkBody again using the already-retained prior.content. This new recovery step therefore runs twice: a wire body containing é becomes é on the second pass, corrupting the retained evidence. Even ordinary recovered é content loses its text_decoding metadata and original observed digest because the second invocation produces no recovery metadata. Keep recovery at the original producer boundary and preserve its metadata through subsequent privacy passes rather than reinterpreting retained bytes.

AGENTS.md reference: AGENTS.md:L27-L27

Useful? React with 👍 / 👎.

Comment on lines +641 to +642
if (value === undefined) {
addPartialNetworkEndpoint(context, node, name, target);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve XHR identity uncertainty on partial endpoints

For an uncertain XHR receiver with a nonliteral destination, such as XMLHttpRequest.prototype.open=custom; new XMLHttpRequest().open('GET', target), this branch calls addPartialNetworkEndpoint without carrying the xhr === "unknown" status. That helper sets only resolution: "partial", which describes target resolution, not receiver identity. Consequently, the endpoint projection in JavaScriptArtifactGraphFindings.ts treats the result as an AST-observed network call rather than an endpoint candidate. Propagate interpretation: "candidate" independently of target resolution so downstream evidence retains the receiver uncertainty.

AGENTS.md reference: AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

@morluto

morluto commented Nov 24, 2026

Copy link
Copy Markdown
Owner

@scaroll thanks for the PR — there are 18 open review threads here:

Could you address or reply to these? Once they're resolved and CI is green we can take another look.
cc @gensokyo-dev @dandgabr

@morluto

morluto commented Nov 24, 2026

Copy link
Copy Markdown
Owner

@scaroll also, this branch has merge conflicts with main — please resolve those along with the open threads.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants