[PR #3600] [MERGED] fix(contracts): reject NUL bytes in objdump and rizin local path inputs #5846

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3600
Author: @qorvr
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @baron

Base: main ← Head: fix/contracts-objdump-rizin-local-path


📝 Commits (2)

  • 84e2090 fix(contracts): reject NUL bytes in objdump and rizin local path inputs
  • f976d14 Merge remote-tracking branch 'origin/main' into HEAD

📊 Changes

2 files changed (+5 additions, -2 deletions)

View changed files

📝 src/domain/reverseEngineering.ts (+3 -2)
📝 tests/acceptance/tools/localToolContracts.test.ts (+2 -0)

📄 Description

Summary

Ensures advertised local tool contracts for inspect_with_objdump and execute_rizin_command reject NUL bytes in path inputs, aligning with established local tool contract boundaries.

Problem and expected behavior

  • In src/domain/reverseEngineering.ts, objdumpArtifactInputSchema.path and rizinInputSchema.path used z.string().min(1) instead of localPathStringSchema.
  • When callers pass paths containing NUL bytes (\0), input passes schema validation and reaches ReverseEngineeringService, propagating until downstream filesystem checks fail (surfacing as AnalysisInputError or ERR_INVALID_ARG_VALUE) instead of being admitted/rejected cleanly at the advertised schema/contract boundary with the canonical NUL error message.
  • Expected behavior: Reject strings with NUL bytes at the advertised contract boundary with a descriptive validation error ("Local filesystem paths cannot contain NUL"), consistent with sibling local path contracts.

Change and scope

  • Replace path: z.string().min(1) with path: localPathStringSchema in objdumpArtifactInputSchema and rizinInputSchema.
  • Add regression coverage to tests/acceptance/tools/localToolContracts.test.ts by adding inspect_with_objdump and execute_rizin_command with NUL path inputs to the shared pathRequests acceptance test table.

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".
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: objdumpInputSchema, rizinInputSchema in src/domain/reverseEngineering.ts.
  • Contribution scope fit and linked maintainer decision: not applicable (existing boundaries and contract hardening).
  • CLI and MCP/tool-catalog contract: inspect_with_objdump and execute_rizin_command local path input validation.
  • Provider, bridge, target-format, or platform compatibility: all platforms.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): none.
  • 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:

  • 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.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: tests/acceptance/tools/localToolContracts.test.ts (added inspect_with_objdump and execute_rizin_command with NUL path inputs to the shared pathRequests test table, asserting early rejection with the descriptive NUL message through public MCP).
  • Base reproduction or other evidence: passing paths with \0 to inspect_with_objdump or execute_rizin_command bypassed schema validation (z.string().min(1)).
  • User-visible CLI/MCP output (if applicable): MCP validation error describing invalid path character ("Local filesystem paths cannot contain NUL").
  • Remaining proof gaps: none.

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

  • npx oxfmt --check . — all matched files passed formatting check.
  • npm run typecheck — 0 errors.
  • npm run check:fast — turbo typecheck, lint passed cleanly.
  • npm test -- tests/acceptance/tools/localToolContracts.test.ts — 5/5 passed (100%).

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: local file contracts across Linux/macOS/Windows.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: Prevents NUL-byte injection in path inputs across reverse engineering tools.

Author readiness

Human owner: @qorvr

  • 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.

🔄 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/3600 **Author:** [@qorvr](https://github.com/qorvr) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@baron](https://github.com/baron) **Base:** `main` ← **Head:** `fix/contracts-objdump-rizin-local-path` --- ### 📝 Commits (2) - [`84e2090`](https://github.com/morluto/rea/commit/84e209057cf4033ee8baf88df7f9d72f87cb2530) fix(contracts): reject NUL bytes in objdump and rizin local path inputs - [`f976d14`](https://github.com/morluto/rea/commit/f976d143118f599d2d43ed711733b01ee3e90089) Merge remote-tracking branch 'origin/main' into HEAD ### 📊 Changes **2 files changed** (+5 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/reverseEngineering.ts` (+3 -2) 📝 `tests/acceptance/tools/localToolContracts.test.ts` (+2 -0) </details> ### 📄 Description ## Summary Ensures advertised local tool contracts for `inspect_with_objdump` and `execute_rizin_command` reject NUL bytes in path inputs, aligning with established local tool contract boundaries. ## Problem and expected behavior - In `src/domain/reverseEngineering.ts`, `objdumpArtifactInputSchema.path` and `rizinInputSchema.path` used `z.string().min(1)` instead of `localPathStringSchema`. - When callers pass paths containing NUL bytes (`\0`), input passes schema validation and reaches `ReverseEngineeringService`, propagating until downstream filesystem checks fail (surfacing as `AnalysisInputError` or `ERR_INVALID_ARG_VALUE`) instead of being admitted/rejected cleanly at the advertised schema/contract boundary with the canonical NUL error message. - Expected behavior: Reject strings with NUL bytes at the advertised contract boundary with a descriptive validation error ("Local filesystem paths cannot contain NUL"), consistent with sibling local path contracts. ## Change and scope - Replace `path: z.string().min(1)` with `path: localPathStringSchema` in `objdumpArtifactInputSchema` and `rizinInputSchema`. - Add regression coverage to `tests/acceptance/tools/localToolContracts.test.ts` by adding `inspect_with_objdump` and `execute_rizin_command` with NUL path inputs to the shared `pathRequests` acceptance test table. 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". 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: `objdumpInputSchema`, `rizinInputSchema` in `src/domain/reverseEngineering.ts`. - Contribution scope fit and linked maintainer decision: not applicable (existing boundaries and contract hardening). - CLI and MCP/tool-catalog contract: `inspect_with_objdump` and `execute_rizin_command` local path input validation. - Provider, bridge, target-format, or platform compatibility: all platforms. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details (if applicable): none. - 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: - [ ] 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. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `tests/acceptance/tools/localToolContracts.test.ts` (added `inspect_with_objdump` and `execute_rizin_command` with NUL path inputs to the shared `pathRequests` test table, asserting early rejection with the descriptive NUL message through public MCP). - Base reproduction or other evidence: passing paths with `\0` to `inspect_with_objdump` or `execute_rizin_command` bypassed schema validation (`z.string().min(1)`). - User-visible CLI/MCP output (if applicable): MCP validation error describing invalid path character ("Local filesystem paths cannot contain NUL"). - Remaining proof gaps: none. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npx oxfmt --check .` — all matched files passed formatting check. - `npm run typecheck` — 0 errors. - `npm run check:fast` — turbo typecheck, lint passed cleanly. - `npm test -- tests/acceptance/tools/localToolContracts.test.ts` — 5/5 passed (100%). ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: local file contracts across Linux/macOS/Windows. - Package or release metadata impact: none. - Security, privacy, process, or containment review: Prevents NUL-byte injection in path inputs across reverse engineering tools. ## Author readiness Human owner: @qorvr - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:09:53 +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#5846
No description provided.