Repository navigation
Conversation
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
| (isUnmodifiedGlobalReference(node.left.object, index.bindings, "location") || | ||
| isUnmodifiedGlobalReference(node.left.object, index.bindings, [ | ||
| "document", | ||
| "location", | ||
| ])); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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], |
There was a problem hiding this comment.
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 👍 / 👎.
[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
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.SummaryThis PR adds timing-aware JavaScript navigation and network scans, plus Ghidra transfer caveats. The latest change also tries to recover charset-less response text.
DiagramsequenceDiagram
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
Reviews (2) · Last reviewed commit: "fix(browser): recover UTF-8 bytes of cha..." · Reviewed by Greptile |
| (isUnmodifiedGlobalReference(node.left.object, index.bindings, "location") || | ||
| isUnmodifiedGlobalReference(node.left.object, index.bindings, [ | ||
| "document", | ||
| "location", | ||
| ])); |
There was a problem hiding this comment.
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.| [ | ||
| ["history", "pushState"], | ||
| ["history", "replaceState"], | ||
| ["location", "assign"], | ||
| ["location", "replace"], | ||
| ["document", "location", "assign"], | ||
| ["navigation", "navigate"], |
There was a problem hiding this 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)
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.
| } else if (url !== undefined && !t.isArgumentPlaceholder(url)) { | ||
| this.#navigation(url); |
There was a problem hiding this comment.
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.| if (value === undefined) { | ||
| addPartialNetworkEndpoint(context, node, name, target); |
There was a problem hiding this 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)
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.| if (t.isNewExpression(direct)) | ||
| return literalUrlObjectTarget(direct, bindings); |
There was a problem hiding this 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)
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.| 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"); |
There was a problem hiding this 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)
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!
| 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++; |
There was a problem hiding this 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)
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], |
There was a problem hiding this 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.
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.| const run = cli.sharedCliRun ?? ((invocation) => cli.run(invocation)); | ||
| const home = await createTestTempDirectory("rea-javascript-cli-home-"); |
There was a problem hiding this 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)
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.| expect(JSON.stringify(projected)).toContain( | ||
| "Input format: auto (default), asar, or directory.", | ||
| ); |
There was a problem hiding this comment.
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"), |
There was a problem hiding this 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)
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.| const recovered = | ||
| phase === "response" | ||
| ? recoverCharsetlessUtf8(exposed, contentType) | ||
| : undefined; | ||
| const observed = recovered?.bytes ?? exposed; | ||
| const textDecoding: CharsetlessTextRecovery | undefined = | ||
| recovered?.recovery; |
There was a problem hiding this comment.
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_decodingfrom 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.| const recovered = | ||
| phase === "response" | ||
| ? recoverCharsetlessUtf8(exposed, contentType) | ||
| : undefined; |
There was a problem hiding this 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)
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.There was a problem hiding this comment.
💡 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".
| phase === "response" | ||
| ? recoverCharsetlessUtf8(exposed, contentType) | ||
| : undefined; |
There was a problem hiding this comment.
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 👍 / 👎.
| if (value === undefined) { | ||
| addPartialNetworkEndpoint(context, node, name, target); |
There was a problem hiding this comment.
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 👍 / 👎.
|
@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. |
|
@scaroll also, this branch has merge conflicts with |
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
location,location.href,location.assign, document location, andhistorynavigation. It also keeps the navigation timing, plus the navigation identity and its uncertainty, when globals are replaced or written dynamically.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.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)
437b97f37fix(ghidra): disclose unrepresented incoming jumps53bfcaefefix(javascript): preserve location navigation timing01786f2bffix(web): resolve direct url request targetsc80ebf63afix(ghidra): disclose incomplete computed targetse1dbb87d8fix(javascript): preserve request argument uncertaintyf417984f5fix(web): recover bounded request targets and uncertainty2603ca80afix(ghidra): disclose conditional external transfers89b85bae2fix(ghidra): disclose uncertain tail transfers86d4eb942fix(javascript): report compound location writesa62c91046fix(javascript): recover document location navigation01db963fbfix(web): recover qualified browser network destinationsdd35aeb05fix(web): exclude replaced browser network methodsdbb56355bfix(web): report uncertain browser network identitye25d78d3ffix(web): retain unknown legacy xhr coverage015797b9afix(web): preserve uncertain XHR coverage6ab6bde72fix(javascript): preserve xhr timing and uncertaintyef56cb3defix(javascript): model navigation api identity620244be8fix(javascript): exclude replaced qualified network calls8396834c7fix(javascript): recover history calls before replacementb920a0117fix(javascript): preserve navigation identity uncertainty8a1b0fafefix(javascript): preserve network calls before replacement99b5075dbfix(javascript): preserve uncertainty after dynamic global writese00bde260fix(javascript): preserve fetch calls before global replacement71121b66cfix(javascript): recover browser location property routes503101799fix(javascript): recover direct location navigation4b235d5bafix(javascript): detect location href navigation0a7c25e00test(javascript): isolate route cli acceptance homesaba8e278ffix(javascript): recover location assign destinationsd72fcd9e6test(cli): isolate compile cache test homesb1570c67atest(javascript): isolate cli acceptance home27331cd8ffix(javascript): recover browser history navigation routesaa7428a7dfix(ghidra): direct missing symbols to name inventoryd7282e636fix(mcp): describe javascript input formatse07106d34fix(ghidra): guide recovery from unknown procedureContract and boundary impact
src/domain/javascript/, the web bundle analyzer, and the Ghidra provider/bridge transfer reporting. Unknown: a per-commit consumer audit is not summarized here.ReaGhidraBridge.java) and the provider changed.Expected effects:
Evidence and regression coverage
src/domain/webBundleAnalyzer.test.ts,src/ghidra/GhidraProvider.behavior.test.ts, and the JavaScript route scan tests.Validation performed
npm run typecheckon merge commit6d4f5ad56: passed.npx vitest run src/domain/webBundleAnalyzer.test.ts src/ghidra/GhidraProvider.behavior.test.tson6d4f5ad56: 331/331 passed.npm teston437b97f37: 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
Author readiness
Human owner: @scaroll
Before merge
type(scope): outcome.🤖 Generated with Claude Code