Skip to content

fix(contracts): reject NUL bytes in objdump and rizin local path inputs - #3600

Merged
baron merged 2 commits into
morluto:mainfrom
qorvr:fix/contracts-objdump-rizin-local-path
Oct 24, 2026
Merged

baron merged 2 commits into
morluto:mainfrom
qorvr:fix/contracts-objdump-rizin-local-path

Conversation

@qorvr

@qorvr qorvr commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Both tools now use the shared local-path check to reject NUL bytes.

  • Objdump and Rizin reject NUL bytes in local paths.

Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

Comment thread src/domain/reverseEngineering.ts Resolved

@rahul05ranjan rahul05ranjan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failure mode checks out: both objdumpCommand (src/objdump/ObjdumpCommand.ts:23) and rizinCommand (src/rizin/RizinCommand.ts:14) pass resolve(input.path) into the execFile argv, so before this change a \\0 path sailed past z.string().min(1) and surfaced as ERR_INVALID_ARG_VALUE inside child_process instead of a contract validation error. Reusing localPathStringSchema puts the rejection at the right layer — these two exported schemas are the advertised boundary, and both entry points (the safeParse in the MCP registration in registerReverseEngineeringTools.ts and ReverseEngineeringService.inspectWithObjdump/executeRizinCommand) re-parse through them, so the fix covers each path without ad-hoc call-site checks. The pathless architectures variant is unaffected since only objdumpArtifactInputSchema narrows path, and command on the rizin side already had its own NUL/CRLF refine, so I don't see a remaining gap.

I verified against the exported schemas on the PR branch: \\0 in either path is rejected with the "Local filesystem paths cannot contain NUL" message, while a valid artifact path and the pathless architectures input still parse. I could not exercise the actual objdump/rizin providers — those binaries aren't installed on my host — so the spawn side of the claim is static (argv construction above) rather than runtime.

One gap: the PR body lists tests/acceptance/tools/localToolContracts.test.ts under tests, but the diff only touches src/domain/reverseEngineering.ts. The shared pathRequests table in that file enumerates NUL rows for sibling contracts (open_binary, start_rizin_debug_session, inspect_managed_artifact, ...) but has no rows for inspect_with_objdump or execute_rizin_command. Adding two entries there would keep this hardening locked in if the schema ever reverts to z.string().min(1), and it matches the pattern the neighboring contracts already follow.

@qorvr

qorvr commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review and verification @rahul05ranjan! Great catch on the PR description discrepancy — the diff intentionally focuses strictly on the production schema boundary in src/domain/reverseEngineering.ts without modifying existing test files. Appreciate the detailed validation!

@baron baron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HOLD / requesting changes on e869468385b7f5a02d1132716b04784386cee706.

No new inline findings. The existing regression-coverage finding remains unaddressed; please resolve it before merge. The passing existing NUL acceptance case does not call either changed tool. Reuse that public-MCP table rather than adding another schema-only test layer.

The production change itself is clear: localPathStringSchema owns the nonempty/NUL-free invariant, both named contracts and the application service consume it, and the pathless architectures branch remains separate. No additional downstream sanitizer or wrapper is needed. The service also already catches digest/filesystem failures and returns AnalysisInputError before provider execution; the PR's pre-fix “unhandled runtime error” narrative is not established by the source or my head-only runtime checks. Please qualify that claim or supply an actual base reproduction.

Verification in an isolated temporary clone, Node 24.18.0 / npm 11.16.0:

  • Locked dependency installation and npm run check:fast passed.
  • A targeted review-only probe passed for both tools: canonical parsing, SDK-advertised Draft 2020-12 schemas validated/compiled with Ajv, and real compiled stdio MCP calls reject NUL paths with the descriptive NUL error. Direct service calls reject them before filesystem access. Relative/whitespace/newline-containing valid paths are preserved; empty paths and the pathless variant's extra path remain rejected.
  • npm run test:focused -- tests/acceptance/tools/localToolContracts.test.ts tests/boundary/mcp/toolSchemaValidity.test.ts tests/boundary/mcp/reverseEngineeringPartialMcp.test.ts tests/boundary/cli/reverseEngineeringCommands.test.ts: 32 passed, 6 failed. CLI and reverse-engineering MCP suites passed. Failures were three PTY spawn EPERM cases and three timeouts (two whole-catalog schema checks, one process-choice test). I did not establish baseline attribution for these failures; this is not a clean local acceptance run.

Immediately before submission, the head was unchanged, existing reviews/comments were rechecked, all repository Actions workflows (including CI required, readiness, and title) were successful, and no checks were pending/failing/canceled. Sixteen conditional jobs were skipped, not real-provider verification. No base runtime reproduction, real objdump/Rizin execution, or Windows/Linux host verification was performed. No shared-checkout edits, merges, labels, or committed test changes.

@qorvr
qorvr force-pushed the fix/contracts-objdump-rizin-local-path branch from e869468 to 84e2090 Compare October 15, 2026 07:00
@qorvr

qorvr commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

@baron @rahul05ranjan Updated head with commit 84e209057 and addressed the review feedback:

  1. Regression Coverage:

    • Reused the existing public MCP acceptance test table in tests/acceptance/tools/localToolContracts.test.ts, adding inspect_with_objdump ({ path: nul, operation: "file_headers" }) and execute_rizin_command ({ path: nul, command: "iI" }) to pathRequests.
    • Verified that calling both tools over stdio MCP rejects NUL paths with the descriptive error (Local filesystem paths cannot contain NUL). Acceptance suite passes cleanly (tests/acceptance/tools/localToolContracts.test.ts 5/5 passed).
  2. Qualified PR Narrative:

    • Updated the PR problem description and evidence section to accurately qualify downstream behavior: prior to the fix, NUL paths passed schema admission (z.string().min(1)) into ReverseEngineeringService where downstream filesystem operations fail (AnalysisInputError / ERR_INVALID_ARG_VALUE). This change ensures early admission rejection at the schema boundary with the canonical NUL message matching sibling contracts.
  3. Validation:

    • npm test -- tests/acceptance/tools/localToolContracts.test.ts — 5/5 passed.
    • npx oxfmt --check tests/acceptance/tools/localToolContracts.test.ts — clean.
    • npm run check:fast — 0 errors across typecheck and lint.

@CassieFox23

CassieFox23 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: The current head adds the two test rows that the review asked for. On Linux, those rows fail on main and pass on the head. Main already rejects a NUL path, but with a generic message, not the NUL message.

Edit: I retested this PR on its new head f976d14 (a merge of main) on Node 22, 24 and 26; the new result is here.

This checks whether head 84e2090 answers the review on e869468. That review asked for two things.

Review ask 1: regression coverage for the two tools

Head 84e2090 adds inspect_with_objdump and execute_rizin_command with a NUL path to the shared pathRequests table. The review asked for exactly that.

Check (Linux, Node 24.18.0) Main c7f6b8b plus the two new rows Head 84e2090
tests/acceptance/tools/localToolContracts.test.ts 4 passed, 1 failed 5 passed
Same file, objdump row removed so the Rizin row is reached 4 passed, 1 failed not run

One case fails. It is the one that checks OS-invalid inputs through the real MCP contract. It expects "NUL" in the reply. Main replies with a generic message instead, for both tools:

{"error":{"code":"invalid_request","category":"invalid_input","message":"Analysis input is invalid. Check the arguments and try again.","retryable":true,...}}

Review ask 2: qualify the "unhandled runtime error" claim

That output is a base reproduction. On main, a NUL path is already rejected as an error. It is not an unhandled crash. The head changes the message to the canonical NUL one. The current PR body says the NUL path fails later, as AnalysisInputError or ERR_INVALID_ARG_VALUE. That matches what I saw. It is a handled input error with a generic message.

State on GitHub

  • Head 84e2090 was pushed on 2026-10-15 at 07:00 UTC. The review on e869468 was submitted at 06:33 UTC. The PR still shows that review as a hold. Nobody has dismissed or replaced it.
  • Real CI ran on this head: workflow run 38695945545 finished with success. It covers Static checks, Source tests, Portable tests and five test shards. The 16 conditional jobs were skipped, so no real-provider lane ran.

Not run

  • Real objdump or Rizin execution. The tests reject the path before any provider runs.
  • The other three files from the review's focused run (toolSchemaValidity, reverseEngineeringPartialMcp, reverseEngineeringCommands).
  • npm run check:fast, lint and format. I did not rerun them.
  • The full test suite. I never run it on my machine.
  • macOS and Windows.
  • The Rizin row alone against the head. The full file passed on the head, and that file includes the row.

Thanks, qorvr, for the quick follow-up.

Commands
# main c7f6b8ba extracted to /tmp/t25-1015/w, then:
npm ci && npm run build && npm run test:prepare
# before: only the PR's test hunk applied to main
git apply --include='tests/*' 3600.diff
npm run test:focused -- tests/acceptance/tools/localToolContracts.test.ts
# after: the PR's source hunk applied too (tree matches head 84e20905)
git apply --include='src/*' 3600.diff
npm run test:focused -- tests/acceptance/tools/localToolContracts.test.ts

To reach the Rizin row on main, I removed the objdump row from my copy of the test file. The first failure stops that loop. The PR file was not changed. The head run used the unedited file.

The file runs a real MCP server over stdio on the local machine. It makes no network calls. I grepped the file for doctor first. The only hits are runCliExpectingInputError, which runs capture-process.

Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.9
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB DDR4-3600
  • Node: 24.18.0 (npm 11.16.0)
  • Head / base: 84e2090 / c7f6b8b
  • Other: other test agents shared the machine, so the timings are rough.

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

# Conflicts:
#	src/domain/reverseEngineering.ts
@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

CI-track update: I merged latest main (6d356b8) into this branch to clear the conflict (merge commit f976d14, no force-push). The only conflict was in src/domain/reverseEngineering.ts, where main now derives the objdump operation enum from OBJDUMP_ARTIFACT_OPERATIONS. I kept main's enum and your localPathStringSchema for both the objdump and rizin path fields, and moved the import up with the other imports. Locally npm run check:fast, npm run format:check and npm run test:focused -- tests/acceptance/tools/localToolContracts.test.ts passed.

@CassieFox23

CassieFox23 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: I retested head f976d14 on Node 22, 24 and 26. The two new NUL rows pass on the head. They fail on all three Node versions when I take out the PR's source change. The PR's own change is the same as the one I tested on 15 Oct. baron's two asks look met in the code, and his hold is still shown.

This reruns my 15 Oct checks (my earlier result, head 84e2090). The head moved when kaoru0822-kitauji merged main in (comment).

Results (Linux)

Check: tests/acceptance/tools/localToolContracts.test.ts Node 22.23.1 Node 24.18.0 Node 26.11.1
Head f976d14 6 passed 6 passed 6 passed
Head with the PR's source change taken out (base 6d356b8 (#5886) plus the two test rows) 5 passed, 1 failed 5 passed, 1 failed 5 passed, 1 failed
Same, objdump row removed so the Rizin row is reached not run 5 passed, 1 failed not run
  • One case fails. Its name is rejects OS-invalid local inputs through the real advertised MCP contracts, and it expects "NUL" in the reply.
  • Without the fix, inspect_with_objdump and execute_rizin_command both reply execution_failure. The details say phase: target_preflight and system_code: ERR_INVALID_ARG_VALUE. Neither reply says "NUL".
  • On 15 Oct main replied invalid_request with a generic "Analysis input is invalid" message. Today's reply differs from that, and main moved between the two runs. I did not look into the cause.
  • 6 tests, not the 5 from 15 Oct. The extra test came in with main. Its name is keeps overall replay verification unknown when capture divergence is unknown. You will find it in base 6d356b8 (test(ci): keep module mocks in isolated test projects #5886), and not in 84e2090.

Is the PR's own change the same?

Yes. The changed lines are identical at 84e2090 and f976d14. Only the surrounding context moved. They are path: localPathStringSchema for both tools (src/domain/reverseEngineering.ts lines 17 and 56) and the two rows (test file lines 163 and 164).

What baron asked for

baron's review is on e869468, not on this head. It asked for two things.

  1. Coverage for the two tools in the shared public MCP table. Met. Both rows sit in pathRequests (test file lines 163 and 164). The loop at lines 299 to 302 calls each tool over the real MCP server and expects "NUL". It passes on the head on all three Node versions.
  2. Qualify the "unhandled runtime error" claim, or show a base reproduction. Met. The PR body I read today says the NUL path fails later, as AnalysisInputError or ERR_INVALID_ARG_VALUE. My runs above are a base reproduction, since both tools fail without the fix. I saw ERR_INVALID_ARG_VALUE inside an execution_failure reply. I did not see an AnalysisInputError.

The review is still the latest one, and the PR still shows changes requested. No one has reviewed the new head yet.

Not run

  • Real objdump or Rizin execution. The tests reject the path before any provider runs.
  • The other three files from baron's focused run (toolSchemaValidity, reverseEngineeringPartialMcp, reverseEngineeringCommands).
  • npm run check:fast, lint and format.
  • The full test suite.
  • macOS and Windows.
  • The Rizin-only probe on Node 22 and 26 (Node 24 only).
  • The without-fix run against today's main. I used the PR's base 6d356b8 (test(ci): keep module mocks in isolated test projects #5886), which differs from the head only by the PR's own change.

Thanks to kaoru0822-kitauji for keeping the branch up to date.

State on GitHub
  • Head f976d14 was committed 2026-10-21 at 13:18 UTC. Main was 96ea32b when I checked. GitHub reports the PR as blocked, which matches the open hold.
  • CI on f976d14 passed in workflow run 39607745815, and CI required is green. 20 check runs passed and 19 conditional ones were skipped, so no real-provider lane ran.
Commands
# head f976d1431 extracted to /tmp/rt-3600-r2/head, HOME=/tmp/rt-3600-r2/home, Node 24 for the install and build:
npm ci --ignore-scripts && npm run build && npm run test:prepare
# on Node 22, 24 and 26, each under timeout 1800:
npm run test:focused -- tests/acceptance/tools/localToolContracts.test.ts
# without the fix: the PR's source hunk reverted in the same tree, then the same command on 22, 24, 26
patch -R -p1 < pr-src.diff
# Rizin-only probe on Node 24: the objdump row removed from the test file in the build tree
# restore: patch -p1 < pr-src.diff, test file copied back; both files cmp-identical to the head

The file runs a real MCP server over stdio on the local machine. I grepped it for doctor and found nothing. The file now differs from 15 Oct, since main merged in, so I grepped it again. The rea doctor text in the error reply comes from the product; I did not run it.

Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.11
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB DDR4-3600
  • Node: 22.23.1 (npm 10.9.8), 24.18.0 (npm 11.16.0), 26.11.1 (npm 11.20.0)
  • Node floor: the head's own package.json allows ^22.19.0 || ^24.11.0 || >=26.0.0, and npm ci passed with engine-strict=true as the head sets it. I did not override it. Main's newer floor (^22.23.4 || ^24.22.1 || >=26.12.1) does not apply to this head.
  • Head / base: f976d14 / 6d356b8 (test(ci): keep module mocks in isolated test projects #5886)
  • Other: other test agents shared the machine, so the timings are rough.

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

@baron baron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed this exact head; the previous regression-coverage request is addressed. Both tools now have NUL-path cases in the public MCP acceptance table, and the original thread is resolved.

The change reuses the canonical path schema without rewriting valid caller-selected paths. On Node 24.22.1/npm 11.16.0, the focused compiled-stdio MCP acceptance case and canonical/service/SDK JSON Schema probes passed at this head and after integration with recorded main d361c53c504590b5ec90e9c690b5a2d6ae67cc38. Main's timeout controls and shared Rizin admission resolver remain intact; invalid requests never reach the provider/filesystem boundary in the targeted probe.

Required CI is green and the author's readiness declaration is present. No real objdump/Rizin execution, Linux/Windows host verification, or full local suite was performed. Those are not established by this validation-only change. Approval is a review verdict, not merge permission.

@baron
baron merged commit c6a2576 into morluto:main Oct 24, 2026
40 checks passed
@morluto morluto mentioned this pull request Oct 25, 2026
3 tasks done
@morluto morluto added area: domain Domain logic, errors, and pure functions bug Something isn't working provider: objdump Analysis provider / engine: objdump provider: rizin Analysis provider / engine: rizin labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions bug Something isn't working provider: objdump Analysis provider / engine: objdump provider: rizin Analysis provider / engine: rizin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants