Repository navigation
Conversation
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. |
|
| for (const name in headers) { | ||
| if (!Object.hasOwn(headers, name)) continue; | ||
| yield name; | ||
| yield headers[name]!; |
There was a problem hiding this comment.
Unused headers hide network records
admitMetadata() budgets header values even though metadata events retain only header_names. With header_values: false, those values never appear in the output. A declared one-character secret makes a valid 6 KiB header value exceed this check, even if the value contains no secret.
The collector then omits otherwise small request, response, and completion records. Selected small bodies can also become unreachable. Budget only the fields metadata retains, and leave header-value limits to captureNetworkHeaders().
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/browser/network/PlaywrightScenarioNetwork.ts
Line: 272-275
Comment:
**Unused headers hide network records**
`admitMetadata()` budgets header values even though metadata events retain only `header_names`. With `header_values: false`, those values never appear in the output. A declared one-character secret makes a valid 6 KiB header value exceed this check, even if the value contains no secret.
The collector then omits otherwise small request, response, and completion records. Selected small bodies can also become unreachable. Budget only the fields metadata retains, and leave header-value limits to `captureNetworkHeaders()`.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Comments Outside DiffThese findings could not be posted inline.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8cbb79eedb
ℹ️ 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".
| sum + this.secrets.redactionAllocationCost(value.length), | ||
| 0, | ||
| ) > MAX_EVENT_COST || | ||
| this.retainedCost >= MAX_CAPTURE_COST |
There was a problem hiding this comment.
Reserve text cost against the remaining capture budget
When retained storage is still below 16 MiB but the candidate's estimated redaction cost exceeds the remaining space, this condition admits it because it only tests whether the budget is already completely full. Redaction then performs its scans/expansion before push() rejects the event, and because retainedCost is unchanged, every later large event can repeat that work; a hostile page emitting selected text events in a scenario with declared secrets can therefore keep driving adapter CPU/allocation after retention has effectively filled. Compare and reserve the candidate estimate against the remaining budget before redaction.
AGENTS.md reference: AGENTS.md:L75-L75
Useful? React with 👍 / 👎.
| const rawText = message.text(); | ||
| if (!this.admitText(rawText)) return; | ||
| const location = message.location(); | ||
| if (!this.admitText(location.url, message.type())) return; |
There was a problem hiding this comment.
Admit each console event under one combined budget
When a console message and its source URL are each below MAX_EVENT_COST but exceed it together, the two independent admissions both succeed, after which both fields are redacted/sanitized and only push() notices that the event is oversized. Repeated large console events can thus bypass the advertised pre-redaction per-event bound without increasing retained state; pass the text, URL, and type through one combined admission/reservation.
AGENTS.md reference: AGENTS.md:L75-L75
Useful? React with 👍 / 👎.
| request(request: ScenarioNetworkRequest): void { | ||
| if (!this.accepting) return; | ||
| const transaction = this.transaction(request); | ||
| if (transaction === undefined || !this.admitMetadata(request)) return; |
There was a problem hiding this comment.
Keep omitted transactions out of redirect links
When a request's metadata exceeds the new 1 MiB admission limit, transaction() has already inserted it into the map before this return. A later redirect from that request therefore receives its ID via transactions.get(predecessor) even though no event with that transaction ID was retained, contradicting docs/browser-scenario-contract.md:248-253, which says redirects link only to observed transactions and otherwise use null; track whether the predecessor event was retained (or defer insertion) before exposing its ID.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
Share tagged readiness observations, retain partial provider facts, authenticate bridge identity, bound diagnostics, and preserve cancellation and lost-session reasons. Fail closed for unparsed MIPS ABI attributes and macOS saved Hopper databases without a script-capable bridge route. Reviewed fixes: #2010, #2108, #2513, #2695, #2731, #2771, #2828, #2867, #2868, #2870, #2880, #2919, #2945, #2961, #2981, #2998, #3000, #3002. Validation: 285 focused source/boundary tests passed. Real Ghidra, IDA, Linux Hopper, and Windows provider runs were not repeated. BREAKING CHANGE: MIPS targets with unresolved GNU ABI attributes and saved Hopper databases on macOS are refused rather than advertised as supported.
Own service-worker CDP registrations and retry failed teardown. Admit redaction and network metadata against remaining capture capacity, retain explicit omission reasons, and preserve source URL, redirect ancestry, caller-selected content, and historical capture values. Forward CLI cancellation through provider cleanup. Reviewed fixes: #2263, #2637, #2767, #2845, #2859, #2863, #2872, #2874, #2876, #2879, #2955, #2957, #2961, #3033. Validation: 25 current event/network source tests passed; earlier focused browser lanes passed 201 source tests and 176 boundary tests with two skips, plus 35 Python tests. Real browser/Windows lanes were not rerun. Playwright allocation before admission remains unbounded by these retention limits.
|
Edit: Main caught up with most of this PR. I retested what is left here. Heads up: main already has this change in f690571. The code is in 🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
|
TL;DR: I retested what is left of this PR after main caught up. The code is already on main and passes there. What main lacks is a short note in docs/testing.md on how to run the Ghidra handshake probe. Main is 95c8f57, the PR head is 8cbb79e. I compared the PR's added lines with main by hand. These are on main under the same names:
The probe script is byte-identical on main.
The probe is the PR's script. It checks these cases:
On the PR's base commit 8fef2aa (#2938) the probe stops at once, because the Java file has no What main does not have:
Thanks, cybrking, for the fix. Earlier I posted here that f690571 covered the network part. This comment adds the rest. Not run
Commandsgit archive main | tar -x -C /tmp/ev-2961/main # main 95c8f57aa
npm ci --ignore-scripts && npm run prepare && npm run build:cached && npm run test:prepare # exit 0, both trees
npm run test:focused -- src/browser/PlaywrightScenarioEvents.test.ts src/browser/network/PlaywrightScenarioNetwork.test.ts tests/boundary/providers/ghidra/ghidraClient.test.ts # Node 24, exit 0
# Node 22 and 26: same file list through the runner, exit 0
/usr/bin/node scripts/run-development-tests.mjs focused <same three files>
python3 tests/fixtures/ghidraHandshakeProbe.py ~/.local/opt/jdk-21.0.12.1+1/bin/java # exit 0 on head and main; on the base it stops with exit 1 before any TCP checkTest setup
🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
|
Closing as superseded by main commits f690571 and d4bd65c, retained at 67a6477. Main contains the event/listener/transaction bounds, loopback handshake admission, retry path, probe script and regressions. The later comparison comment above independently confirms the original checks on main. Main deliberately queues extra content work within bounded transaction admission rather than immediately omitting it. The remaining short probe-running documentation note does not require retaining this broad implementation PR and can be proposed separately if still useful. This audit used current-main source/test inspection and existing discussion evidence; it did not rerun a browser or Ghidra workflow. |
Summary
Bound browser scenario retention and content scheduling, and reject unauthenticated loopback clients without consuming the Ghidra session. This is a draft with partial browser remediation: Playwright body acquisition still needs a separately enforced producer memory boundary. No issue is linked because this follows a requested repository security review.
Problem and expected behavior
Scenario events and selected network work previously accumulated without collection budgets. The loopback bridge also allowed its first unauthenticated connection to consume the sole session. Resource omissions must remain visible in evidence, and rejected handshake clients must leave the bridge available for its legitimate caller.
Change and scope
Contract and boundary impact
Evidence and regression coverage
Executed regression coverage includes ordinary event/content controls, individual and aggregate retention budgets, count exhaustion, listener capacity reuse, producer non-invocation after admission rejection, redaction expansion, dropped metadata, loopback reconnect/retry exhaustion, and normal provider cleanup.
The JDK harness compiles the production preauthentication read and accept methods with parsing/dispatch fixture seams. It executes rejection, EOF, frame ceiling, idle and slow-trickle deadlines, acceptance of a later valid client, pipelined requests, and authenticated requests larger than the handshake ceiling. It does not compile or run the complete Ghidra engine bridge.
Base vulnerability analysis was source-derived. The new budget/retry assertions contradict the former unbounded/terminal behavior; no exploit was run against a deployed application.
Validation performed
npm run test:focused -- tests/boundary/providers/ghidra/ghidraClient.test.ts tests/boundary/providers/ghidra/ghidraTransport.test.ts— 41 tests passed.python3 tests/fixtures/ghidraHandshakeProbe.py /path/to/java— passed with a temporary Temurin JDK 21 on macOS.npm run check— passed typecheck, compiled lint, formatting, knip, metadata, module boundaries, and architecture guards.npm run docs:check— passed, including five README consistency tests.npm run verify:test-discovery— all 1,112 test files discovered exactly once.git diff --check— passed.Compatibility, safety, and release
Unresolved browser acquisition boundary:
Response.body()still materializes the complete buffer before the 64 KiB retention check. Incoming Playwright payloads and headers are likewise acquired before adapter admission. A timeout settles a capture job but does not cancel its underlying producer operation. These limits reduce retained copies and scheduled work; they do not establish a complete host-memory bound or close the full browser finding. Preserving body semantics requires supervised producer isolation with enforced memory limits, or a separately designed bounded CDP collector with correct transaction identities and explicit provenance.The loopback change bounds disruption by an individual rejected client. Repeated queued connections can still delay startup. A real Windows Ghidra lane and a real-browser resource-isolation lane were unavailable on this macOS host; those remain required before treating the relevant platform/containment claims as established.
Before merge