mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
Closed
opened 2026-10-31 01:04:33 +00:00 by bsakaguchi
·
0 comments
No Branch/Tag specified
main
codex/procedure-reference-stacked
release-please--branches--main--components--rea-agents
release-please--branches--main--components--rea-agents--release-notes
codex/kuna-independent-retry
codex/byte-search-overlay-coverage
codex/open-failure-target-receipt
codex/kuna-xref-evidence
codex/ghidra-ambiguous-procedure-recovery
codex/function-source-bundle
codex/trace-function-integration-prototype
codex/snapshot-source-closure
codex/recorded-evidence-array-pages
codex/evidence-recovery-redesign
codex/trace-feature-address-scope
codex/call-discovery-scope
codex/ghidra-literal-candidate-evidence
codex/decompile-directory-independent-retry
codex/retry-provenance-base
codex/value-flow-capability-experiment
codex/ghidra-containing-instruction
cursor/readme-discord-button-ef9f
dependabot/github_actions/actions/setup-node-7.1.0
dependabot/github_actions/actions/upload-artifact-7.0.2
dependabot/npm_and_yarn/npm-minor-and-patch-d8d97ce6df
codex/kuna-1989
fix/8559-native-ui-fixture-ownership
fix/8555-go-verifier-mcp-ownership
codex/provider-capability-recovery
fix/8642-rizin-target-stdin
codex/ghidra-memory-effect-scope
codex/ghidra-annotation-entry-selector
codex/ghidra-readonly-recovery
codex/ghidra-regex-verifier-recovery
codex/evidence-discovery-view-guidance
fix/8545-bulk-append-overflow
fix/8428-navigation-refusal-alternatives
codex/address-context-recovery
codex/matching-member-limitations
codex/unknown-scope-contract
codex/evidence-view-guidance
feat/8373-native-trace-views
codex/ghidra-snapshot-verifier-binding
codex/elf-export-visibility
codex/evidence-view-recovery
codex/native-reference-cli-help
codex/provider-candidate-observation-scope
codex/kuna-session-verification
codex/ghidra-switch-lifetime-guidance
codex/pseudocode-paging-discovery
codex/clarify-evidence-view-support
codex/kuna-xrefs-selector-recovery
codex/context-capacity-recovery
codex/evidence-closure-large-links
codex/same-function-evidence-identity
codex/ghidra-verifier-inspected-jdk
codex/audit-guided-workflows
codex/crash-prompt-retained-dossiers
codex/analysis-view-error-recovery
codex/kuna-verifier-target-selection
codex/ghidra-selected-project-call-coverage
codex/docs-native-analysis-scope
codex/ghidra-java-socket-boundary
codex/ghidra-retained-snapshot-verifier
codex/ghidra-search-inventory-facts
fix/8284-zero-argument-parameter-bindings
fix/8198-ui-action-handler-offset
fix/8257-elf-entry-label-identity
fix/8304-deferred-output-schema-projection
fix/8277-call-path-computed-target-uncertainty
fix/pr-8089-conflicts
fix/ci-static-duplicate-export
dependabot/npm_and_yarn/lint-staged-17.6.0
dependabot/github_actions/actions/download-artifact-8.0.2
dependabot/npm_and_yarn/write-file-atomic-8.0.0
dependabot/npm_and_yarn/canonicalize-5.1.0
dependabot/github_actions/actions/cache/restore-6.1.0
dependabot/npm_and_yarn/toon-format/toon-4.4.0
dependabot/github_actions/actions/deploy-pages-5.0.1
codex/review-fixes-pr-2403
codex/review-fixes-pr-2400
codex/process-terminal-width
codex/test-brittleness-cleanup
verify/7167-browser-connect-macos
fix/7167-browser-connect
feat/native-matching-allowance-setting
feat/browser-scenario-dry-run
test/managed-caller-parameters-20261024
codex/parser-fortythird-boundaries
fix/6926-pinvoke-platform-decorations-20261023
fix/6889-har-body-encoding-20261023
fix/6888-sqlite-schema-budget-20261023
fix/dependency-security-gates-6708
cursor/evidence-overwrite-rebase-b4ac
feat/4057-verify-native-exports
fix/windows-acl-observer-overhead-20261022
cursor/erlang-beam-restack-4476
cursor/pe-certificate-review-bf32
fix/6116-javascript-application-fs-errors
fix/6061-unmapped-runtime-script-unknown
feat/browser-scenario-summary
fix/pe-certificates
codex/verify-3407
cursor/rebase-5699
cursor/rebase-5352
cursor/rebase-5600
cursor/fix-cli-schema-omission-10a8
codex/audit-hopper-shutdown-reasons-20261021
fix/demangle-swift-omitted-record
fix/nib-boolean-value-types
cursor/cancellation-partial-observation-a5ac
fix/ib-object-limit-reasons
fix/electron-fuse-limit-advice
fix/kuna-doctor-dangling-cache
fix/fixed-budget-refusal-advice
fix/js-ipc-listener-dedup
fix/js-return-member-provenance
fix/dmg-integrity-retry-advice
fix/ida-doctor-readiness
fix/kuna-version-probe-output-drain
fix/legacy-swift-runtime-name-matching
fix/dylib-lazy-load-commands
fix/browser-scenario-startup-cancel
fix/swift-nested-punycode-classification
fix/compare-unselected-scopes
fix/objc-method-budget-coverage
fix/dmg-mounted-root-observations
audit/ci-tests-20261019-round2
release/6.7.0
fix/wabt-cleanup-retry-resolution
fix/electron-fuse-elf-pe-architecture
fix/native-plist-descriptor-ownership
fix/kuna-caller-cleanup-ownership
experiment/atomic-codemode-20261016
review/first-contributor-3776
fix/call-resolution-full-read-cycles
fix/member-mutation-selection-repeat
experiment/atomic-re-tools-20261015
perf/member-mutation-lazy-origins
perf/static-network-mutation-index
fix/hopper-startup-lifecycle
audit/3050-windows-proof-20261015
feat/windows-window-capture-2183
audit/3049-windows-proof-20261015
audit/3735-macos-fixtures-20261015
fix/batch-decompile-null-pseudocode
fix/kuna-inventory-honors-jobs
experiment/browser-codemode-tool-design-20261015
fix/hopper-clean-runtime-argv
codex/review-2049-27f1b367
review-fixes/pr-2787-routing
fix/3360-scoped-this-emitters
fix/3367-replaced-global-effects
fix/3838-compact-any-value-items
test/hopper-download-probe-20261015
codex/windows-runtime-creation-red-green-20261015
codex/windows-readonly-root-red-green-20261015
codex/windows-root-share-red-green-20261015
codex/exp-1685-win-mcp-startup
codex/bug-sweep-20261015
investigate/2190-windows-package-phases
investigate/3543-macos-cli-deadline
perf/3281-reverse-tools-feedback-quality
fix/3406-hopper-doctor-fixture
fix/3341-wrapper-require-test-context
fix/3301-owned-uninstall-fixtures
fix/3164-compiler-input-ownership
fix/pcap-cleanup-stdout-newline-20261014
perf/interface-builder-summary
codex/review-fixes-pr-1977
fix/ghidra-effective-jvm-platform
fix/docs-turkish-rust-link-20261013
fix/main-maintenance-ci-20261010
fix/recover-binary-session-process-effects
codex/review-fixes-pr-2457
codex/ci-required-cancellation-gate
fix/main-format-baseline-20261013
fix/setup-preserve-entry-fields
cursor/restore-main-checks-1ffc
fix/ghidra-bridge-hashmap-import
codex/shared-ci-jadx-json-default-20261013
codex/shared-ci-ghidra-test-groups-20261013
codex/shared-ci-java-fixture-format-20261013
codex/fix-intrinsic-invocation-boundaries
test/release-preflight-reusable-jobs
test/js-parameter-provenance-expectation
fix/linux-hopper-verification-current
test/2419-ghidra-elf-probe-size
followup/pr-1544-native-ida
codex/fold-pr-2230-contribution
docs/readme-responsible-use
fix/issue-2064
fix/issue-2050
fix/issue-2053
fix/issue-1968
fix/issue-1945
experiment/codemode-bridge-20261011
fix/tool-effects-negative-wording-1904-20261012
fix/1842-electron-interop-provenance
feat/recover-javascript-multi-input
refactor/website-i18n-prep
fix/nativeaot-pe-virtual-extent
fix/browser-verifier-ci-hang
fix/pe-resources-input-selection
docs/beginner-friendly-guides
docs/beginner-setup-guide
fix/javascript-analysis-worker-1563
fix/1649-ghidra-duplicate-names
fix/javascript-export-keys-integration-1369
test/maintenance-boundary-contracts-20261011
review/javascript-export-keys-1369
review/process-live-progress-1483
test/javascript-1495-growth-ratio
fix/ci-escape-timing
docs/normalized-terminal-geometry-1450
release/6.3.0
archive/release-6.3.0-pr1381
release/6.2.0
fix/electron-preload-dynamic-override
fix/javascript-self-referential-bundler-edges
release/6.1.0
cursor/grok-client-cherry-pick-0b56
feat/signature-posture
feat/dyld-shared-cache
feat/artifact-integrity-policy
feat/pkg-inventory
release/6.0.0
chore/sync-release-5.0.0
release/5.0.0
cursor/cloud-agent-node-787e
fix/javascript-xhr-open-endpoints
review/pr-711-realpath-fallback-wording
cleanup/replay-confinement
codex/test-suite-performance
codex/issue-foundations
codex/address-open-issues-2026-07-20
agent/javascript-vite-rollup-esbuild-adapters
agent/process-cleanup
agent/triage-integration
agent/unknown-commands-registry
feat/mcp-identity-metadata
morlvps/issue_cleanup
codex/installer-redesign
morl/roadmap-investigation-core
morl/roadmap-investigation-docs
release-please--branches--main--components--rea
rea-agents-6.8.0
rea-agents-6.7.0
rea-agents-6.6.0
experiment/atomic-codemode-wait-runtime-20261016
rea-agents-6.5.0
rea-agents-6.4.0
rea-agents-6.3.0
rea-agents-6.2.0
rea-agents-6.1.0
rea-agents-6.0.0
rea-agents-5.0.0
rea-agents-4.1.0
rea-agents-4.0.1
rea-agents-4.0.0
rea-agents-3.2.1
rea-agents-3.2.0
rea-agents-3.1.0
rea-agents-3.0.0
rea-agents-2.7.0
rea-agents-2.6.0
rea-agents-2.5.1
rea-agents-2.5.0
rea-agents-2.4.0
rea-agents-2.3.0
rea-agents-2.2.0
rea-agents-2.1.0
rea-agents-2.0.0
rea-agents-1.7.0
rea-agents-1.6.0
rea-agents-1.5.0
rea-agents-1.4.0
rea-agents-1.3.0
rea-agents-1.2.0
rea-agents-1.1.0
rea-agents-1.0.0
rea-agents-0.5.0
rea-agents-0.4.0
rea-agents-0.3.0
rea-0.2.1
rea-0.2.0
Labels
Clear labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
Mirrored from GitHub Pull Request
question
roadmap
triage
No labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
question
roadmap
triage
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
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#5175
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/morluto/rea/pull/2341
Author: @mvanhorn
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @morluto
Base:
main← Head:fix/masked-byte-pattern-search📝 Commits (5)
527278afeat(native): search analyzed memory for masked byte patterns742a02bfix(native): limit unbounded byte search to loaded memory3b87a5afix(native): reconcile byte search coverage and target provenancec661f8ffix(native): preserve implicit address spaces in range consumers82cc51ffix(native): reject present malformed byte search state📊 Changes
24 files changed (+980 additions, -36 deletions)
View changed files
📝
bridge/ghidra/ReaGhidraBridge.java(+162 -12)📝
docs/ghidra-provider.md(+29 -0)📝
docs/native-investigation.md(+14 -0)📝
docs/user-visible-errors.csv(+3 -0)📝
scripts/verify-real-ghidra-raw.mjs(+88 -0)📝
src/application/DirectAnalysis.ts(+1 -0)📝
src/cli/coreNativeCommands.ts(+40 -0)📝
src/cliCommandNames.ts(+1 -0)📝
src/contracts/hopperMemoryContracts.ts(+19 -0)📝
src/contracts/toolContractExamples.ts(+1 -0)📝
src/contracts/toolEffects.ts(+1 -0)📝
src/contracts/toolOutputSchemaGroups.ts(+2 -0)📝
src/domain/hopperValues.ts(+5 -14)➕
src/domain/native/addressCoordinate.ts(+11 -0)➕
src/domain/native/bytePattern.test.ts(+33 -0)➕
src/domain/native/bytePattern.ts(+125 -0)📝
src/ghidra/GhidraInventoryValues.ts(+34 -0)📝
src/ghidra/GhidraProviderCapabilities.ts(+5 -0)📝
src/hopper/HopperProviderCapabilities.ts(+7 -3)📝
tests/boundary/mcp/ghidraInventoryMcp.test.ts(+270 -2)...and 4 more files
📄 Description
Summary
Agents can now find where a byte signature occurs in an opened native target:
search_bytes(CLIsearch-bytes) takes hexadecimal byte pairs with??wildcards and an optional bit mask, searches Ghidra's initialized analyzed memory, and returns ordered matches with segment, source file offset and containing procedure, plus exact page coverage and a bound continuation cursor. Hopper advertises the operation as unavailable with a typed reason.No issue is linked. This is a new native tool, proposed here with the implementation.
Demo
Full-quality MP4
The video shows real output from this branch's MCP server and Ghidra provider code, driven against the repository's fake Ghidra fixture (
tests/fixtures/fakeGhidra.mjs), since Ghidra is not installed on this host. The match addresses come from the fixture. It shows48 8b ?? ?? 89matching at 0x1000 and 0x1005 with.bsslisted as skipped, the same search paged withlimit: 1andnext_cursor, and??alone rejected as invalid.Problem and expected behavior
read_bytesreads bytes at an address the caller already knows, andsearch_stringsand procedure search cover names and strings. Onupstream/main(2e45b4d) nothing answers "where does48 8B ?? ?? 89occur", so locating a constant table, a prologue, a magic header or an opcode sequence with wildcarded operands means reading memory page by page and matching client side.With this change, one call such as
{"pattern": "48 8B ?? ?? 89", "limit": 100}on an open Ghidra session returns observed Evidence withmatches(address,segment,file_offsetornull,procedure{address, name}ornull),searched(blocksandbytesexamined on this page,skipped_uninitialized),completeandnext_cursor. Repeating the same query withcursor: next_cursorcontinues untilcompleteis true.Change and scope
Pattern grammar is owned by
src/domain/native/bytePattern.tsand shared by the MCP contract, the Ghidra inventory schema and the CLI. A pattern is hexadecimal byte pairs (either case) or??, with optional whitespace between pairs. Empty patterns, odd nibbles (4,4?), non-hex characters and patterns where every bit is unconstrained (??, orffwith mask00) are rejected as typed input errors before dispatch. The optionalmaskis hexadecimal pairs of the same length; each mask byte selects which bits of the pattern byte must match (pattern: "a0", mask: "f0"matchesa0throughaf).??stays fully unconstrained even when a mask is given, and an omitted mask meansfffor every non-wildcard byte.Optional
startandendare inclusive and must lie in one address space withstart <= end. Without bounds every memory block is eligible, in Ghidra address order.limitaccepts 1 to 1000 and defaults to 100.The Ghidra bridge (
searchMemoryBytesinbridge/ghidra/ReaGhidraBridge.java) walks blocks sorted by start address and callsMemory.findBytesper initialized block with the end bound pulled back bylength - 1, so a match never crosses a block boundary. After each hit it resumes at the next address, so overlapping matches are kept (00 00over00 00 00gives two hits). Uninitialized blocks inside the bounds are never searched and are listed insearched.skipped_uninitializedon every page.searched.blocksreports the inclusive ranges examined for this page, including the lookahead that found the next unreturned match, so coverage can overlap between pages and should not be summed as unique memory.The cursor is
<binding>:<address>. The binding is SHA-256 over a JSON array of the target SHA-256, profile digest, normalized pattern bytes, masks, canonical start and end, and the document. The address is the first match not yet returned, so resuming neither skips nor repeats a match. The bridge rejects a cursor whose binding differs from the current target and query, or whose address is outside initialized memory or the query bounds. Cancellation is checked between blocks and around eachfindBytescall; it returns a typedcancellederror, discards the active Ghidra database and never produces a successful partial page.The bridge re-validates its request at the socket boundary: required keys
document,pattern,limit, allowed extrasmask,start,end,cursor, anything else isinvalid_request. It also re-applies the pattern, mask, constraint and bounds rules instead of trusting the TypeScript layer.file_offsetcomes from a new shareduniqueFileOffsethelper that returns an offset only when exactly one file-backed source mapping covers the address and the offset fits a JavaScript safe integer.address_to_file_offsetnow uses the same helper. That is a small visible change: its failure text changes fromAddress has N authoritative source mappings: <addr>toAddress lacks a unique safe file offset: <addr>, and an offset aboveNumber.MAX_SAFE_INTEGERis now rejected instead of returned.Hopper lists
search_bytesin its capabilities withavailable: falseand the reason "Masked byte search has not been verified for Hopper.", so the call fails ascapability_unavailablewithout launching Hopper.Out of scope: a Hopper implementation, searching uninitialized or overlay memory, matches spanning block boundaries, string or regex search over bytes, and any write, patch or execution.
Contract and boundary impact
src/domain/native/bytePattern.ts(bytePatternFields,parseBytePattern,validateBytePattern,byteSearchResultSchema); Ghidra provider input/result schemas insrc/ghidra/GhidraInventoryValues.ts; search inbridge/ghidra/ReaGhidraBridge.java.search_bytes(src/contracts/hopperMemoryContracts.ts, strict input withpattern,mask?,document,start?,end?,limit1 to 1000 default 100,cursor?; output schema insrc/contracts/toolOutputSchemaGroups.ts; example{pattern: "48 8B ?? ?? 89"}insrc/contracts/toolContractExamples.ts; effectevidenceinsrc/contracts/toolEffects.ts). New CLI commandsearch-bytes <path> <pattern> --mask --start --end --cursor --limitplus the existing native open options (src/cli/coreNativeCommands.ts,src/cliCommandNames.ts,src/application/DirectAnalysis.ts). The result schema rejects pages wherecompletedisagrees withnext_cursororsearched.bytesdisagrees with the block sum, and the Ghidra schema also requires canonical addresses.search_bytesin its inventory, bridge dispatch and capability limitations (src/ghidra/GhidraProviderCapabilities.ts); same effects as other Ghidra reads, snapshot cache policy. Hopper reports the operation unavailable (src/hopper/HopperProviderCapabilities.ts).address_to_file_offseterror text changes as described above.docs/public/product-catalog.json), package, or installation impact: docs indocs/ghidra-provider.md(Masked byte search) anddocs/native-investigation.md(Locate a byte signature); three rows indocs/user-visible-errors.csv(unconstrained pattern, unequal mask length, cursor reused with another query). The new tool and command appear in the generated catalog; no authored skill text changed.metadata:checkanddocs:checkpass; no build outputs committed.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
The only process involved is the headless Ghidra analyzer that every Ghidra operation already starts; its capability effects are unchanged and the target itself is never launched or attached.
Evidence and regression coverage
src/domain/native/bytePattern.test.ts(whitespace, tab and no-break-space separators;??and bit masks combined; empty, odd-nibble,4?, non-hex, all-wildcard, all-zero-mask, unequal-length and non-hex masks rejected with typed issues on the right field);tests/boundary/mcp/ghidraInventoryMcp.test.ts(a page and its continuation retained as Evidence; a page whosecompletecontradictsnext_cursorrejected asunreadable_output; invalid patterns rejected before any provider call; cancellation projected as typedcancelledwith no structured content; an end-to-end run throughGhidraProviderand the socket bridge usingtests/fixtures/fakeGhidra.mjs, covering pagination withlimit: 1, cursor continuation, skipped.bsscoverage, file offsets and procedure);tests/boundary/mcp/officialArguments.test.ts(CLI and MCP dispatch the same arguments withlimit: 100defaulted;??, unequal mask,4?,limit: 1001andcursor: nullrejected before dispatch);tests/boundary/mcp/officialTools.test.ts(Hopper returnscapability_unavailableforsearch_byteswithout launching; strict schema rejects unknown keys and defaultslimitto 100).scripts/verify-real-ghidra-raw.mjsgains real-Ghidra assertions (see gaps).2e45b4d, give 7 failed and 9 passed: every new byte-search test fails (Tool search_bytes not found, or the contract lookup returnsundefined), and the pre-existing tests in those files still pass.bytePattern.test.tswas not run on the base because its module does not exist there.{"pattern": "48 8b ?? ?? 89", "limit": 1}ismatches: [{address: "0x1000", segment: ".text", file_offset: 0, procedure: {address: "0x1000", name: "fixture_main"}}],searched: {blocks: [{segment: ".text", start: "0x1000", end: "0x1009", bytes: 10}], bytes: 10, skipped_uninitialized: [{segment: ".bss", start: "0x2000", end: "0x200f", bytes: 16}]},complete: false; the continuation returns0x1005withfile_offset: 5andcomplete: true.{"pattern": "??"}fails withPattern must constrain at least one bit. On Hopper the call fails withcapability_unavailable,provider_id: "hopper",operation: "search_bytes". These values are fixture output, not a real Ghidra run.npm run verify:ghidra:raw(needsGHIDRA_INSTALL_DIR) was not run, and the new assertions inscripts/verify-real-ghidra-raw.mjswere not executed. Those assertions cover a single-match signature withfile_offset: 0and procedure, a 1005-match file paged as 1000 then 5 with the continuation starting at0x2770(no skip or repeat), abf/f0nibble mask, overlapping00 00matches at0x1002and0x1003, a cursor rejected for a different pattern, the target file unchanged after close, and first-search timing. Until that lane runs, the Java search loop, cursor binding and resume, block clamping and theaddress_to_file_offsetrefactor are source-derived; the TypeScript side is covered by the fixture boundary tests and unit tests above.For evidence-bearing changes:
Validation performed
All on macOS arm64 with Node 26.5.0 and npm 12.2.0.
On a clone at
2e45b4dwith only the updated boundary tests and fixture applied, the same focused run over the three boundary files fails 7 of 16 tests, all of them the new byte-search cases.npm run verify:ghidra:rawwas not run (no Ghidra install on this host).npm run check:prwas not run for this change.Compatibility, safety, and release
address_to_file_offsetfailure text, which now readsAddress lacks a unique safe file offset: <addr>, and its rejection of offsets aboveNumber.MAX_SAFE_INTEGER, which previously could not be represented exactly as a JavaScript number anyway. The new tool and command are additive.Before merge
type(scope): outcome.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.