Repository navigation
feat(ghidra): admit set_address_name and set_addresses_names - #1635
Conversation
Ghidra sessions rejected the existing naming tools with "operation is not declared by this provider", so agents had to use annotate_native_function, which returns a complete function dossier per rename and cannot name data addresses. The Java bridge now names a local function entry (namespace-aware, like annotate_native_function) or creates/renames the primary label at any other mapped address, verifying readback. set_addresses_names applies each address in its own transaction and reports per-address booleans. Both are mutating capabilities: excluded from read-only (Windows P0) handshakes and from snapshot replay.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Share namespace-aware leaf normalization across functions and primary labels. Invalid qualified leaves now return false for naming operations without marking the provider unavailable; function annotations retain typed invalid-input errors. Extend real CLI/MCP namespace verification with namespaced globals, readback replay, failed-name rollback, mixed batches, and capability checks. Validation: 75 focused tests and npm run check pass. Ghidra 12.1.4/JDK 21 namespace verification passes on macOS arm64 with unchanged source bytes and complete cleanup. The full host lane passes this workflow before the existing entry-alias fixture fails because the compiler places its interior label at the function entry.
|
Thanks for your first PR, @giri256, and welcome to REA! 🎉 This is a useful addition—compact naming for Ghidra function entries and globals makes the investigation workflow much smoother. I appreciate the detailed write-up, regression coverage, and real-provider verification. I've pushed fixes for the two namespace edge cases found during review, along with regression coverage. Thanks again for contributing! |
|
TL;DR: The new rename tools work on Linux with Ghidra. I renamed functions and data, one at a time and in a batch. The names showed up in the decompiled code. I checked main at 0f605bca9 (#1602), which includes 6e0d5d6 (#1635). The target was a small x86-64 ELF built with gcc. It had three functions and two globals. Results
The reopen result matches the stated limit. Edits are not saved in a Ghidra project. I saw two small things that may surprise a caller.
Not run
Thanks, Giridhar, for the feature. Thanks, morluto, for the namespace fixes. Test setup
🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
Summary
Ghidra sessions now admit
set_address_nameandset_addresses_names. Before this change both failed withcapability_unavailable: operation is not declared by this provider, so agents had to rename throughannotate_native_function, which returns a full function dossier per call and cannot name data addresses.Fixes #1634
Problem and expected behavior
open_binaryon any x86/x64 PE with Ghidra, thenset_address_name {address, name}. The result iscapability_unavailable.set_address_namereturns a boolean;set_addresses_namesreturns a record of per-address booleans. Function entries and data addresses are both nameable, and the names show up in later pseudocode,address_nameandlist_names.Change and scope
ReaGhidraBridge.java):applyAddressNameruns one transaction per address.annotationLeafName, so qualified names behave as inannotate_native_function.falseand rolls back only that address. Unmapped addresses fail the single operation withinvalid_requestand arefalseinside a batch.GHIDRA_INVENTORY_OPERATIONS, with strict input schemas (a batch needs at least one entry) and boolean result schemas.GHIDRA_MUTATING_OPERATIONS(annotate_native_functionplus the naming operations) is the single source for:mutatesArtifact;set_comment/set_inline_comment/ bookmarks for Ghidra, and persistence beyond the ephemeral session.Contract and boundary impact
src/ghidra/*Values.ts,GhidraProviderCapabilities.ts) and the Java bridge.annotate_native_function.Evidence and regression coverage
GhidraSessionValues.test.ts: naming is treated as mutation, and a missing naming capability fails the handshake.ghidraEvidenceMcp.test.ts: MCP routing and exact provider inputs; compact boolean and record results; an empty batch is rejected before the provider; malformed bridge output givesunreadable_output.ghidraClienthandshake now include the new capabilities.main,set_address_nameagainst Ghidra returnscapability_unavailable(operation is not declared by this provider).Validation performed
All on the rebased commit (base
be44b50), Node 26.10, Arch Linux x64:npx tsc --noEmit -p tsconfig.json: passnpx vitest run src/ghidra: 243 passednpm run test:focused -- tests/boundary/mcp/ghidraEvidenceMcp.test.ts tests/boundary/providers/ghidra/{ghidraClient,ghidraTransport,ghidraTargetSnapshot}.test.ts: 4 files, 38 passednpm run check:fast: pass (pre-commit oxfmt/oxlint also pass)npm run verify:ghidra(real provider) did not pass locally, and the failure does not look related to this change:entry-aliasesscenario failed inclose_binarywithcleanup_incomplete:owned launcher command identity did not match (observed=[java]; expected=.../bin/java). This looks like a shutdown race where the JVM is already defunct when the ownership check reads it.Compatibility, safety, and release
Review checklist
type(scope): outcome.