Repository navigation
fix(ghidra): disclose missing PDB symbol coverage - #2275
Conversation
Adversarial Review Finding:
|
|
@greptileai review |
|
This PR is set for a Plus review. TREX isn't supported with Plus or Apex reviews yet, so Greptile reviews this PR at Base while TREX is on. |
|
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: a6df916523
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6fc0e136bc
ℹ️ 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".
| .refine( | ||
| (pdb) => | ||
| [ | ||
| pdb.file, | ||
| pdb.guid, | ||
| pdb.age, | ||
| pdb.signature, | ||
| pdb.version, | ||
| ].reduce<number>((sum, value) => sum + (value?.length ?? 0), 0) <= | ||
| PDB_ATTRIBUTE_UTF16_BUDGET, | ||
| "PDB attributes exceed the aggregate wire budget", |
There was a problem hiding this comment.
PDB limits lack boundary tests
The new 4096-unit limit has no boundary tests. Existing PDB tests only use short strings and never supply resource_limit. A future mismatch between the Java bridge and TypeScript reader could reject valid startup reports or lose the omission warning without failing these tests.
Add tests for exactly 4096 units, combined overflow across individually valid fields, and omitted attributes reaching PE Evidence.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/ghidra/GhidraSessionValues.ts
Line: 71-81
Comment:
**PDB limits lack boundary tests**
The new 4096-unit limit has no boundary tests. Existing PDB tests only use short strings and never supply `resource_limit`. A future mismatch between the Java bridge and TypeScript reader could reject valid startup reports or lose the omission warning without failing these tests.
Add tests for exactly 4096 units, combined overflow across individually valid fields, and omitted attributes reaching PE Evidence.
---
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!
|
Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open. A loaded PDB was incorrectly treated as complete symbol authority. ghidraPdbLimitations now emits a loaded-state caveat independently of missing/unloaded states, so the shared PE execution boundary carries it into health, inventory, search and function Evidence. Updated the existing loaded-state regression expectation and documentation; a reported load never attests full names/types or absence after an empty search. Published in c84ced1. Validation: inspected the original finding, producing boundary and affected consumers; source formatting only. Tests, builds, checks, lint, typechecks, provider workloads and CI reruns were skipped at the user’s explicit request. Any authored regressions are unexecuted. No directly related cleanup remains identified in this bounded source pass; broader contribution-scope and real-provider verification requirements remain before integration. The bridge serialized target-controlled PDB strings without accounting for expansion, and every PE execution could repeat them. PDB attributes now share a producer-side 4096 UTF-16-unit budget, at most 24 KiB after worst-case JSON escaping. Whole attributes that do not fit become null plus an explicit bounded resource_limit report naming omissions; values are not truncated. The handshake schema checks both individual and aggregate size and ghidraPdbLimitations propagates the omission as unknown, including when all attributes were omitted. Retained values and loaded state remain unchanged. Published in c84ced1. Validation: inspected the original finding, producing boundary and affected consumers; source formatting only. Tests, builds, checks, lint, typechecks, provider workloads and CI reruns were skipped at the user’s explicit request. Any authored regressions are unexecuted. No directly related cleanup remains identified in this bounded source pass; broader contribution-scope and real-provider verification requirements remain before integration. |
Problem
Refs #2259. A PE's CodeView metadata can reference a PDB that Ghidra did not load. REA's private executable import omits the sibling PDB, but successful analysis Evidence does not disclose missing symbol coverage. An empty name search can therefore look complete without explaining why original names are unavailable.
Change
pdb_observations: program-info-v1to PE analysis profiles so snapshots produced before this reporting change have a different identity.Validation
Published commit
5890b2a076127dd2801e8aa781928d7106a766e9has the exact validated treef5d14d3dc7b10ab1be8971f882ae05002318af52of local commit23b6b11176fefa9c94ffb16881d7feed5eef332a, based on upstream11fe5a13f8aee87d0c0e036a9f497407e085fe48. Linux x64, repository-pinned Node 24.18.0 and npm 11.16.0:npm run test:focused -- src/ghidra/GhidraSessionValues.test.ts src/ghidra/GhidraProvider.behavior.test.ts src/ghidra/GhidraInventoryValues.test.ts tests/boundary/mcp/ghidraInventoryMcp.test.ts— 4 suites, 85 tests passed.npm run check— passed: runtime compilation, typecheck, formatting, lint (0 errors; warnings reported), knip, metadata, resolved module boundaries, architecture guards.npm run docs:check— passed, including both README consistency tests.npm run verify:test-discovery— all 950 test files discovered exactly once.git diff --check— passed.The regressions first failed on the original source: the handshake rejected PDB facts and direct searches skipped the handshake projection. After the change they pass. Public MCP testing uses the actual provider/service/server pipeline with synthetic bridge facts, a generated PE fixture, retained Evidence, and function snapshot replay. It does not establish behavior of an installed Ghidra engine.
The Java APIs and attribute meanings were checked against Ghidra 12.1.4 source:
PdbParserConstants and PdbProgramAttributes.
Remaining verification — draft
Real producer verification (2026-10-12)
Ghidra 12.1.4 and Temurin JDK 21.0.12.1+1 were downloaded from official GitHub releases, and both published SHA-256 digests matched. All packaged Java bridge sources compiled against the installed Ghidra jars.
On Linux x64, Clang/LLD 18.1.8 cross-compiled a small self-owned C fixture to x86_64-pc-windows-msvc PE32+ with a matching PDB and a relative CodeView PDB path. This is a Linux-host PE/PDB producer check, not Windows/MSVC-host verification.
3828e3c48d2670453cd054837a9a44f2ad91d95895013460de83eb82c6a89a6c.7047ef95-97c7-9e00-4c4c-44205044422e; hexadecimal age1.add_numbersandmain. Calling the compiled production bridge'spdbObservationagainst this Program returnedloaded: true; the production TypeScript limitation projection returned no missing-PDB warning.FUN_140001000andentry. Ghidra omitted thePDB Loadedattribute. The production bridge preserved that omission asloaded: null; the TypeScript projection reported the referenced file/GUID/age and unknown load state. It did not manufacture a false loaded state.Remaining host/provider gap
Actual REA CLI and MCP search attempts remain blocked before engine launch by this environment's process-ownership prerequisite: Node-spawned
ps -axo pid=,ppid=,pgid=,uid=,stat=,command=fails withfatal library error, lookup self. The same command works from the outer shell, and the Node subprocess failure was checked independently. Ownership checks were not bypassed, and the failed workflows are not counted as PASS.Complete real CLI/MCP outcome propagation and lifecycle/cleanup verification still need a compatible host. Windows native ownership and MSVC-host reproduction were not exercised. Keep the PR draft until the required real-provider lane completes.
This addresses the reporting portion of #2259. Automatic or caller-selected matching-PDB admission remains outside this change; do not close the broader issue as fully resolved without the maintainer's scope decision.
The added output consists of six handshake attributes and one limitation when needed. Cold/warm real-engine elapsed time, CPU, peak process-family memory, and completed-task token costs have not been measured.