[PR #4386] [CLOSED] refactor(ghidra): share native AOT entry class constant #6209

Closed
opened 2026-10-31 01:12:42 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4386
Author: @anupamme
Created: 10/16/2026
Status: ❌ Closed

Base: main ← Head: fix-repo-rea-java-lang-security-audit-unsafe-reflection-unsafe-reflection-bridge-ghidra-rea-a40df5c7


📝 Commits (3)

  • 1f5fb51 harden: secure ReaGhidraExtensions.java
  • b6a2f5f refactor(ghidra): share native AOT entry class constant
  • add51a5 docs(ghidra): align class-load comment with shared constant

📊 Changes

1 file changed (+5 additions, -2 deletions)

View changed files

📝 bridge/ghidra/ReaGhidraExtensions.java (+5 -2)

📄 Description

Summary

ReaGhidraExtensions.analyze allowlists one extension entry class, then loads a class by name. After the first commit on this PR the class name was a string literal at both the guard and Class.forName, so a rename touching only one site would turn a valid descriptor into a loader failure. This PR keeps one definition of the name (NATIVE_AOT_ENTRY) and uses it at both sites.

Problem and expected behavior

  • Scanner finding: java.lang.security.audit.unsafe-reflection on Class.forName(entry, ...).
  • Source-derived: the guard already rejects any entry other than rea.extensions.nativeaot.NativeAotExtension, so Class.forName could only receive that value. This change does not alter runtime behavior.
  • Expected: the allowlisted name is defined once; any other entry_class is still rejected with Unregistered Ghidra extension ABI.

Change and scope

  • Adds private static final String NATIVE_AOT_ENTRY in bridge/ghidra/ReaGhidraExtensions.java; the guard compares entry against it and Class.forName loads it.
  • Not included: the nativeaot id, integration API check, artifact path/digest validation, loader lifecycle. The same name on the TypeScript side (src/ghidra/extensions/nativeaot/NativeAotAdapter.ts) cannot share a Java constant and is unchanged.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Contribution scope here: not applicable (no new provider or capability).
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: ReaGhidraExtensions descriptor validation, before class loading.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: Ghidra bridge source only; no behavior change.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • 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. (Refactor with no behavior change.)
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

Evidence is source-derived. Nothing was executed locally.

  • Tests added or updated: none; behavior is unchanged.
  • Base reproduction or other evidence: none; there is no failing behavior to reproduce.
  • User-visible CLI/MCP output (if applicable): none.
  • Remaining proof gaps: the Java bridge was not compiled or run locally (no Ghidra classpath).

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • No local commands were run to validate this change.

  • GitHub Actions: the CI, PR title and PR readiness runs on the current head show action_required or failure (readiness fails on the unfilled owner handle). The bridge compile check passed on 1f5fb51 and has not run on later heads.

  • command — result

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none; real Ghidra extension loading was not exercised.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no change to the trust boundary; the existing allowlist guard remains the control.

Author readiness

Human owner:

  • 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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/4386 **Author:** [@anupamme](https://github.com/anupamme) **Created:** 10/16/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-repo-rea-java-lang-security-audit-unsafe-reflection-unsafe-reflection-bridge-ghidra-rea-a40df5c7` --- ### 📝 Commits (3) - [`1f5fb51`](https://github.com/morluto/rea/commit/1f5fb51a1607bdb98f010eb949cf352dc311c260) harden: secure ReaGhidraExtensions.java - [`b6a2f5f`](https://github.com/morluto/rea/commit/b6a2f5fe7e406c144e6c91fc28bcf54794ed5e40) refactor(ghidra): share native AOT entry class constant - [`add51a5`](https://github.com/morluto/rea/commit/add51a5b8717834a2c15c524f069eb78155ddaf8) docs(ghidra): align class-load comment with shared constant ### 📊 Changes **1 file changed** (+5 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `bridge/ghidra/ReaGhidraExtensions.java` (+5 -2) </details> ### 📄 Description ## Summary `ReaGhidraExtensions.analyze` allowlists one extension entry class, then loads a class by name. After the first commit on this PR the class name was a string literal at both the guard and `Class.forName`, so a rename touching only one site would turn a valid descriptor into a loader failure. This PR keeps one definition of the name (`NATIVE_AOT_ENTRY`) and uses it at both sites. ## Problem and expected behavior - Scanner finding: `java.lang.security.audit.unsafe-reflection` on `Class.forName(entry, ...)`. - Source-derived: the guard already rejects any `entry` other than `rea.extensions.nativeaot.NativeAotExtension`, so `Class.forName` could only receive that value. **This change does not alter runtime behavior.** - Expected: the allowlisted name is defined once; any other `entry_class` is still rejected with `Unregistered Ghidra extension ABI`. ## Change and scope - Adds `private static final String NATIVE_AOT_ENTRY` in `bridge/ghidra/ReaGhidraExtensions.java`; the guard compares `entry` against it and `Class.forName` loads it. - Not included: the `nativeaot` id, integration API check, artifact path/digest validation, loader lifecycle. The same name on the TypeScript side (`src/ghidra/extensions/nativeaot/NativeAotAdapter.ts`) cannot share a Java constant and is unchanged. Follow the [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope). Unresolved scope, authority, side effects, or required verification block integration. Link the required maintainer scope decision for new providers or capabilities involving target execution, injection, mutation, or protection recovery; ordinary fixes within existing boundaries may state "not applicable". Contribution scope here: not applicable (no new provider or capability). Draft PRs may leave the scope decision pending and the readiness and merge checklists unchecked. Maintainers can help resolve open questions. ## Contract and boundary impact - Semantic owner and earliest changed stage: `ReaGhidraExtensions` descriptor validation, before class loading. - Contribution scope fit and linked maintainer decision: not applicable. - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: Ghidra bridge source only; no behavior change. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact (CI generates and validates ignored catalogs and `skills/`; edit authored instructions in `.agents/skills/reverse-engineer-anything/` and never commit build outputs): none. Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible. - [ ] 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. - [x] Documentation or usability only; no target interaction. (Refactor with no behavior change.) - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage Evidence is source-derived. Nothing was executed locally. - Tests added or updated: none; behavior is unchanged. - Base reproduction or other evidence: none; there is no failing behavior to reproduce. - User-visible CLI/MCP output (if applicable): none. - Remaining proof gaps: the Java bridge was not compiled or run locally (no Ghidra classpath). For evidence-bearing changes: - [ ] Observed, derived, and inferred claims remain distinguishable. - [ ] Artifact identity, source provenance, and failed attempts remain preserved. - [ ] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - No local commands were run to validate this change. - GitHub Actions: the `CI`, `PR title` and `PR readiness` runs on the current head show `action_required` or `failure` (readiness fails on the unfilled owner handle). The bridge compile check passed on 1f5fb51 and has not run on later heads. - `command` — result ## Compatibility, safety, and release - Breaking changes or migration steps: none. <!-- For ! / BREAKING CHANGE: show a previously valid call/configuration, its new behavior and migration, and why compatibility/deprecation cannot preserve it. Every release increments minor, including breaking changes; keep breaking markers and migration notes so callers can assess compatibility. See docs/releasing.md. --> - Real Hopper/Ghidra, browser, or OS coverage: none; real Ghidra extension loading was not exercised. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no change to the trust boundary; the existing allowlist guard remains the control. ## Author readiness Human owner: <!-- @GitHub-handle --> - [ ] 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](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:12:42 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6209
No description provided.