[PR #1363] [MERGED] feat(go): inspect embedded binary build metadata #2828

Closed
opened 2026-10-17 21:10:45 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1363
Author: @Y0UW1SH
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @morluto

Base: main ← Head: feat/go-build-metadata


📝 Commits (10+)

  • dd8d172 feat(go): inspect embedded binary build metadata
  • 9f8ff3e fix(go): preserve byte metadata and validate container mappings
  • cbe413f fix(go): support moduleless legacy build metadata
  • ff55686 fix(go): reject undersized PE optional headers
  • 7d35038 fix(go): sync upstream and retain admitted inspection evidence
  • 3370277 fix(native): stabilize ELF memory checks and clean up exec wrappers
  • 010d365 chore(go): sync upstream main
  • eb2bb6e chore(go): sync upstream main
  • db99974 chore(go): sync upstream for final readiness review
  • 9e9988b test: repair Electron fixtures and stabilize catalog startup checks

📊 Changes

48 files changed (+4777 additions, -21 deletions)

View changed files

📝 .agents/skills/reverse-engineer-anything/SKILL.md (+6 -0)
📝 .agents/skills/reverse-engineer-anything/references/native-and-artifacts.md (+11 -0)
➕ .github/workflows/real-go-binary.yml (+58 -0)
📝 README.md (+1 -0)
📝 docs/.vitepress/config.ts (+1 -0)
📝 docs/cli.md (+11 -0)
➕ docs/go-binaries.md (+99 -0)
📝 package.json (+1 -0)
📝 scripts/lib/catalog-builders.mjs (+5 -0)
📝 scripts/lib/catalog-core.mjs (+2 -0)
📝 scripts/lib/module-boundaries.mjs (+1 -0)
➕ scripts/verify-go-binary.mjs (+518 -0)
📝 src/application/CapabilityInventory.ts (+2 -0)
➕ src/application/go/GoBinaryPort.ts (+19 -0)
➕ src/application/go/GoBinaryService.test.ts (+178 -0)
➕ src/application/go/GoBinaryService.ts (+106 -0)
📝 src/cli.ts (+2 -0)
➕ src/cli/goCommands.ts (+31 -0)
📝 src/cliCommandNames.ts (+1 -0)
➕ src/composition/go.ts (+6 -0)

...and 28 more files

📄 Description

Current head — 079b262bb

Merged main through bd74c7af2, resolved the overlapping source-map test conflicts, and preserved both addressed review threads. The Go effects wording audit now recognizes static metadata inspection. Source-map verification checks retained declaration identity and compiler-derived coordinates, and output admission follows the actual serialized representation under the existing 32 MiB budget.

All 32 current-head checks pass, including all four test shards, coverage aggregation, the required CI gate, every platform package lane, full CI, and real Go verification. GitHub reports no merge conflicts.

Local validation on the final merge: 218 focused tests, npm run check, pre-push check:fast, and real Chrome 154 / esbuild 0.25.10 source-map verification passed, including all four nested-map scenarios with verified process lineage. Earlier integration and verification notes below are historical.

Earlier integration — 01c6c4d94

Merged main through ee50ed121 and resolved the conflicts while preserving Go and WASM registration, shared schema validation and upstream's replacement binary-layout verifier. Both review threads are addressed: Go Evidence architecture now uses the canonical supported-family list, retaining MIPS; the real-Go workflow also triggers for changes to src/domain/dosMz.ts.

The MIPS regressions cover the compiled CLI and MCP session snapshot readback. The real verifier now includes a compiler-produced MIPS binary and checks Evidence subject architecture. On the final tree, Go 1.26.5 verification passed for 11 binaries / 22 public CLI and MCP cases on macOS arm64, with verified process lineage and no inspected target execution.

Validation: npm run check, npm run docs:check, pre-push check:fast, and discovery of all 909 tests passed. The initial integration passed 150 focused tests with 3 Linux-only skips; after the final main-only sync, all 43 selected CLI/MCP, catalog-schema and runtime tests passed again. Real Linux binary-layout verification was not run locally. GitHub reports no merge conflicts; current-head CI is running. Earlier CI and verification results below are historical.

Earlier hardening: 5d23c1e

The branch includes upstream main at c1efa646 and preserves the Go metadata implementation and MCP schema hardening. The newest sync adopts upstream's shared MCP helper with only the per-tool SDK options added, preserving its unknown-tool behavior and every validation assertion while minimizing future conflicts.

Recurring CI causes addressed:

  • Electron fixtures establish proven Electron module identity while retaining option, preload, and source-range assertions.
  • The cold catalog lifecycle test inherits the shared bounded, coverage-aware deadline.
  • Runtime/workflow tests pass the called tool's advertised definition to the SDK, avoiding compilation of every unrelated catalog schema. Structured responses remain validated.
  • The dedicated catalog test compiles every input/output schema. A review reproduced a false green caused by nested schema IDs leaking between tools; the validator now clears non-meta schemas after each root, including failure paths. New regressions cover successful and failed preceding compilations.

The Go inspector belongs in built-in artifact inspection: no Go runtime or third-party provider is required, and inspected binaries are never executed. Its CLI/MCP contracts, cancellation, capability inventory, session admission, and saved Evidence integration were reviewed without another actionable defect.

Validation on current head 5d23c1e: all CI jobs and real Go verification passed. The full CI run passed all four test shards and merged coverage: 7,522 tests passed / 89 skipped, across 809 discovered files (798 passed / 11 skipped). All Linux, Windows, Intel Mac, and Apple Silicon package checks passed, as did Apple end-to-end checks, static checks, build, and documentation validation.

Real Go verification passed for 10 compiler-produced binaries / 20 public CLI and MCP cases, with verified process lineage. The catalog lifecycle test completed in 4.0 seconds, and all 11 schema tests passed in CI. Local build artifacts, 20 focused tests (2 platform-specific skips), full npm run check, and independent review also passed. The PR has no merge conflicts and is ready for review.

Its immediate parent 7f5a64e passed every CI job, including all platform packages, all four test shards, and merged coverage: 7,350 tests passed / 89 skipped across 803 discovered files. Real Go verification passed for 10 compiler-produced binaries / 20 public CLI and MCP cases, with verified process lineage. The catalog lifecycle test took 3.8 seconds in CI, versus 23.6 seconds before per-tool schema compilation. The nested-ID regression failed before the fix, and all 11 schema cases then passed locally and in CI. These parent results do not substitute for the current merge's CI.

Earlier commit 9e9988b passed all four test shards and merged coverage (7,323 passed / 89 skipped). Later intermediate CI runs were superseded and canceled by branch updates, so their incomplete coverage aggregation is not a full-suite result for the current head. All validation recorded below is historical.

CI follow-up — 3370277

The real binary-layout lane timed out while expecting a memory constraint, then rejected cleanup because a Python wrapper had exec'd into the interpreter. The decoder now uses the existing parent/group/run-token ownership path for exec wrappers. Regression tests require cleanup for the owned interpreter and refuse signaling on wrong parent or run token.

The memory probe now uses a valid 32 MiB padded ELF under a 64 MiB address-space limit, with successful public CLI/MCP controls under normal limits. It still requires a typed allocation failure, exact reported limit when available, complete diagnostics, and unchanged input bytes. Production deadlines and all failure assertions remain intact.

Validation: check:fast and full npm run check passed; 61 focused tests passed across ownership, Go CLI/MCP, and session-snapshot regressions. Real bridge probes with the pinned Python packages passed on Python 3.12.3 and 3.12.14. Full local real-provider verification remains blocked by the container's procps/process-ownership boundary. GitHub's real binary-layout lane now passes on this exact head: 151 public CLI/MCP cases, 4 bootstrap boundary cases, no target execution, and verified process lineage. The fresh real Go and recorded-crash lanes also pass. The broader CI workflow is still pending; full-suite success is not yet claimed.

Earlier upstream sync — 7d35038

Merged upstream main at 0d899783 and resolved the README, CLI command inventory, MCP composition, and Vitest conflicts while preserving both Go metadata inspection and the newer upstream features. Authored Go skill guidance follows upstream's .agents/skills/ relocation.

Also reproduced and fixed an integration race: inspect_go_binary now uses the shared admitted Evidence handler, so a concurrently closing session includes the in-flight inspection in its saved snapshot. The new public MCP regression failed before the fix and passes afterward.

Validation during this sync:

  • 151 focused tests passed across 10 files, including Go reader/service/CLI/MCP, snapshot replay, PE resources, and product catalog checks.
  • npm run check, npm run docs:check, and test discovery passed; all 772 test files are discovered exactly once. Final check:fast passed after incorporating the latest Android-only upstream change.
  • Real Go 1.26.1 verification passed for 10 compiler-produced binaries and 20 public CLI/MCP cases against Go's own reader. Local process-lineage observation remains unavailable.
  • The additional JADX integration attempt had 4 passes and 29 failures blocked by this container's process-ownership ps error (fatal library error, lookup self). This is an explicit verification limitation; no real JADX result is claimed.

The merge commit's real Go lane passed. Its real binary-layout lane found the resource-limit/cleanup failure addressed by the follow-up above. Earlier verification below is historical and does not establish the current head's complete CI status.

Adds inspect_go_binary and rea inspect-go-binary PATH --json for compiler version, modules, dependency replacements and ordered build settings embedded in a selected local binary.

The built-in TypeScript reader requires no Go runtime. Inspection reads file bytes without executing the selected artifact, launching an analysis subprocess, changing the file or accessing the network. Go is used only to produce verification fixtures.

Behavior

  • Reads ELF, PE and thin Mach-O: 32/64-bit images, applicable byte orders, Go 1.18+ inline strings and historical pointer encoding.
  • Uses producer-selected sections/mappings and virtual alignment. Preserves exact source offsets, SHA-256 artifact identity, compiler bytes, framed module bytes, duplicate settings, local replacements, empty fields and unfamiliar records.
  • Go strings may contain arbitrary bytes. Undecodable go_version / module_text are null, with exact bytes in base64. Decodable module records remain available; undecodable lines are retained in unparsed_line_bytes_base64 and mark the module result incomplete.
  • Returns build_info: null when metadata is absent; absence does not prove a file is non-Go. Malformed files and unsupported containers retain distinct typed errors.
  • Integrates the target-free MCP contract, session Evidence, tool effects, CLI catalog, generated documentation inputs and skill guidance.
  • Rejects symlinks and changing file snapshots. Separate guards bound file reads to 256 MiB, embedded strings to 1 MiB, structural tables to 16 MiB and normalized reports to 8 MiB. MCP's response budget also applies.

Universal Mach-O, XCOFF and Plan 9 remain outside this reader. Embedded supply-chain claims are observed content; this tool does not authenticate them or recover functions/types.

rea inspect-go-binary ./application --json
{"name":"inspect_go_binary","arguments":{"path":"/artifacts/application"}}

Bug review

The follow-up review reproduced and fixed:

  • Rejection of valid non-UTF-8 compiler/settings strings produced by Go.
  • Validation of the unused inline pointer-width byte; pointer encoding still validates its width.
  • Acceptance of contradictory PE/Mach-O mappings, including overlaps covering only part of the metadata.
  • PE data-directory counts extending beyond the declared optional header.
  • Valid DOS/NE/LE/LX files receiving malformed-PE errors, and corrupt high-bit signatures being mistaken for old Windows formats.
  • Valid moduleless Go 1.17 binaries being rejected because their empty module header lives in zero-initialized memory outside the stored file bytes. The complete optional header must lie in declared zero-fill, without any conflicting file mapping; arbitrary unmapped pointers and compiler/string data stay strict. Empty-module source locations are documented zero-byte anchors at the original module-pointer field.
  • Initial symlink-loop (ELOOP) and overlong-path (ENAMETOOLONG) errors being misclassified as provider failures instead of invalid selected input. Post-validation replacement errors retain their artifact-changed classification.

The real verifier now clears unrelated startup-target/cache-helper settings and fixes module mode. Each CLI diagnostic regression has its own unchanged test deadline.

Earlier validation (before upstream sync)

Earlier local checks on the pre-sync follow-up tree:

  • 134 tests passed, zero failed: 130 Go tests across reader, mapping checks, module parser, provider, service, compiled CLI and MCP schemas/results, plus 4 shared stable-artifact tests. Zero-fill regressions include every supported width/byte-order layout, partial and full aliases, overflow, missing file bytes, __PAGEZERO exclusion and strict malformed pointer behavior.
  • npm run test:prepare, npm run check:ci, npm run docs:check and test discovery passed; all 705 test files are assigned exactly once. Duplication checks retain the existing threshold.
  • 10 real Go 1.26.1 binaries / 20 public CLI and MCP cases passed against Go's standard debug/buildinfo oracle: stripped ELF/PE/Mach-O, 32-bit images, big-endian ppc64, sectionless ELF, local replacement and compiler-produced arbitrary byte strings. Source bytes/digests/ranges and CLI/MCP equality are checked; inspected targets are never executed.
  • The real lane passed with deliberately unrelated startup-target/cache-helper values and ambient module mode disabled. Windows explicitly reports omission of the Unix byte-argument producer case.
  • Authentic Go 1.17.13 pointer metadata passed for 5 binaries / 10 public CLI and MCP cases: the official moduleless go, gofmt, compile and link binaries, plus a module-bearing fixture with local replacement. Results agree with Go's reader, bind source spans/digests, preserve source bytes and match across CLI/MCP. Inspected targets were never executed.
  • Independent review of the fixes and real verifier completed.
  • Additional review probes passed: 20,000 Go-generated setting records, including Unicode, escapes and byte-valued strings; 10,000 seeded parser mutations/truncations across formats, widths, byte orders and encodings, with only typed failures and byte-exact valid source ranges; and 15 additional compiler-produced binaries / 30 CLI and MCP cases. The real binaries cover modern PIE/shared-library/plugin output, legacy PIE/shared-library and PE/Mach-O output, s390x/MIPS/RISC-V, FreeBSD and Windows ARM64. These are one-off review probes, not additional committed CI tests.

Earlier CI for follow-up commit cbe413fd9b291d7a5f37c8fc78db482e3b62aec0 passed all four test shards and merged coverage: 6,417 tests passed / 89 skipped across 712 discovered files (701 passed / 11 skipped). Full-suite checks and the real Go lane passed; the latter verified 10 binaries / 20 public cases with Go 1.26.1 and process lineage. Static checks, documentation, package build, both Linux native package lanes, the Windows package/capability lane and Apple artifact E2E also passed. All 29 CI checks passed, including both Darwin package lanes.

Local process-lineage observations are explicitly unavailable on this host; the verifier does not claim OS isolation. The earlier incomplete local full-suite attempt is not counted as a passing gate.

No dependency changes, compiled fixtures, generated output, SQLite changes or unrelated fixes are included.


🔄 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/1363 **Author:** [@Y0UW1SH](https://github.com/Y0UW1SH) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/12/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `feat/go-build-metadata` --- ### 📝 Commits (10+) - [`dd8d172`](https://github.com/morluto/rea/commit/dd8d1726453017c713956cb953676a0fcc10f22f) feat(go): inspect embedded binary build metadata - [`9f8ff3e`](https://github.com/morluto/rea/commit/9f8ff3e594ec53ca1200397105ff99e44a564716) fix(go): preserve byte metadata and validate container mappings - [`cbe413f`](https://github.com/morluto/rea/commit/cbe413fd9b291d7a5f37c8fc78db482e3b62aec0) fix(go): support moduleless legacy build metadata - [`ff55686`](https://github.com/morluto/rea/commit/ff55686f6aa77f145cca54aa3a757821eba6848b) fix(go): reject undersized PE optional headers - [`7d35038`](https://github.com/morluto/rea/commit/7d350380e2305d18c42978fc7d8f1c25804615a1) fix(go): sync upstream and retain admitted inspection evidence - [`3370277`](https://github.com/morluto/rea/commit/3370277ee4087bf1ac225eff7ff2d370b27e6a1c) fix(native): stabilize ELF memory checks and clean up exec wrappers - [`010d365`](https://github.com/morluto/rea/commit/010d365eaa98d79ea6d7b5e843240cbb13d11ac8) chore(go): sync upstream main - [`eb2bb6e`](https://github.com/morluto/rea/commit/eb2bb6ec52bff8deb8692a44e277e44cbde0d327) chore(go): sync upstream main - [`db99974`](https://github.com/morluto/rea/commit/db999745c6430d9d072a9ff3fcec4152b86e7062) chore(go): sync upstream for final readiness review - [`9e9988b`](https://github.com/morluto/rea/commit/9e9988b394e42695f52786fca2fbdfcc1f66fbe9) test: repair Electron fixtures and stabilize catalog startup checks ### 📊 Changes **48 files changed** (+4777 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `.agents/skills/reverse-engineer-anything/SKILL.md` (+6 -0) 📝 `.agents/skills/reverse-engineer-anything/references/native-and-artifacts.md` (+11 -0) ➕ `.github/workflows/real-go-binary.yml` (+58 -0) 📝 `README.md` (+1 -0) 📝 `docs/.vitepress/config.ts` (+1 -0) 📝 `docs/cli.md` (+11 -0) ➕ `docs/go-binaries.md` (+99 -0) 📝 `package.json` (+1 -0) 📝 `scripts/lib/catalog-builders.mjs` (+5 -0) 📝 `scripts/lib/catalog-core.mjs` (+2 -0) 📝 `scripts/lib/module-boundaries.mjs` (+1 -0) ➕ `scripts/verify-go-binary.mjs` (+518 -0) 📝 `src/application/CapabilityInventory.ts` (+2 -0) ➕ `src/application/go/GoBinaryPort.ts` (+19 -0) ➕ `src/application/go/GoBinaryService.test.ts` (+178 -0) ➕ `src/application/go/GoBinaryService.ts` (+106 -0) 📝 `src/cli.ts` (+2 -0) ➕ `src/cli/goCommands.ts` (+31 -0) 📝 `src/cliCommandNames.ts` (+1 -0) ➕ `src/composition/go.ts` (+6 -0) _...and 28 more files_ </details> ### 📄 Description ### Current head — `079b262bb` Merged main through `bd74c7af2`, resolved the overlapping source-map test conflicts, and preserved both addressed review threads. The Go effects wording audit now recognizes static metadata inspection. Source-map verification checks retained declaration identity and compiler-derived coordinates, and output admission follows the actual serialized representation under the existing 32 MiB budget. **All 32 current-head checks pass**, including all four test shards, coverage aggregation, the required CI gate, every platform package lane, [full CI](https://github.com/morluto/rea/actions/runs/38200001145), and [real Go verification](https://github.com/morluto/rea/actions/runs/38200000856). GitHub reports no merge conflicts. Local validation on the final merge: 218 focused tests, `npm run check`, pre-push `check:fast`, and real Chrome 154 / esbuild 0.25.10 source-map verification passed, including all four nested-map scenarios with verified process lineage. Earlier integration and verification notes below are historical. ### Earlier integration — `01c6c4d94` Merged main through `ee50ed121` and resolved the conflicts while preserving Go and WASM registration, shared schema validation and upstream's replacement binary-layout verifier. Both review threads are addressed: Go Evidence architecture now uses the canonical supported-family list, retaining MIPS; the real-Go workflow also triggers for changes to `src/domain/dosMz.ts`. The MIPS regressions cover the compiled CLI and MCP session snapshot readback. The real verifier now includes a compiler-produced MIPS binary and checks Evidence subject architecture. On the final tree, Go 1.26.5 verification passed for **11 binaries / 22 public CLI and MCP cases** on macOS arm64, with verified process lineage and no inspected target execution. Validation: `npm run check`, `npm run docs:check`, pre-push `check:fast`, and discovery of all 909 tests passed. The initial integration passed 150 focused tests with 3 Linux-only skips; after the final main-only sync, all 43 selected CLI/MCP, catalog-schema and runtime tests passed again. Real Linux binary-layout verification was not run locally. GitHub reports no merge conflicts; current-head CI is running. Earlier CI and verification results below are historical. ### Earlier hardening: `5d23c1e` The branch includes upstream `main` at `c1efa646` and preserves the Go metadata implementation and MCP schema hardening. The newest sync adopts upstream's shared MCP helper with only the per-tool SDK options added, preserving its unknown-tool behavior and every validation assertion while minimizing future conflicts. Recurring CI causes addressed: - Electron fixtures establish proven Electron module identity while retaining option, preload, and source-range assertions. - The cold catalog lifecycle test inherits the shared bounded, coverage-aware deadline. - Runtime/workflow tests pass the called tool's advertised definition to the SDK, avoiding compilation of every unrelated catalog schema. Structured responses remain validated. - The dedicated catalog test compiles every input/output schema. A review reproduced a false green caused by nested schema IDs leaking between tools; the validator now clears non-meta schemas after each root, including failure paths. New regressions cover successful and failed preceding compilations. The Go inspector belongs in built-in artifact inspection: no Go runtime or third-party provider is required, and inspected binaries are never executed. Its CLI/MCP contracts, cancellation, capability inventory, session admission, and saved Evidence integration were reviewed without another actionable defect. Validation on current head `5d23c1e`: **all CI jobs and real Go verification passed**. The [full CI run](https://github.com/morluto/rea/actions/runs/38103616406) passed all four test shards and merged coverage: **7,522 tests passed / 89 skipped**, across 809 discovered files (798 passed / 11 skipped). All Linux, Windows, Intel Mac, and Apple Silicon package checks passed, as did Apple end-to-end checks, static checks, build, and documentation validation. [Real Go verification](https://github.com/morluto/rea/actions/runs/38103616212) passed for 10 compiler-produced binaries / 20 public CLI and MCP cases, with verified process lineage. The catalog lifecycle test completed in 4.0 seconds, and all 11 schema tests passed in CI. Local build artifacts, 20 focused tests (2 platform-specific skips), full `npm run check`, and independent review also passed. The PR has no merge conflicts and is ready for review. Its immediate parent `7f5a64e` passed **every CI job**, including all platform packages, all four test shards, and merged coverage: **7,350 tests passed / 89 skipped** across 803 discovered files. Real Go verification passed for 10 compiler-produced binaries / 20 public CLI and MCP cases, with verified process lineage. The catalog lifecycle test took 3.8 seconds in CI, versus 23.6 seconds before per-tool schema compilation. The nested-ID regression failed before the fix, and all 11 schema cases then passed locally and in CI. These parent results do not substitute for the current merge's CI. Earlier commit `9e9988b` passed all four test shards and merged coverage (**7,323 passed / 89 skipped**). Later intermediate CI runs were superseded and canceled by branch updates, so their incomplete coverage aggregation is not a full-suite result for the current head. All validation recorded below is historical. ### CI follow-up — [`3370277`](https://github.com/Y0UW1SH/rea/commit/3370277ee4087bf1ac225eff7ff2d370b27e6a1c) The real binary-layout lane timed out while expecting a memory constraint, then rejected cleanup because a Python wrapper had exec'd into the interpreter. The decoder now uses the existing parent/group/run-token ownership path for exec wrappers. Regression tests require cleanup for the owned interpreter and refuse signaling on wrong parent or run token. The memory probe now uses a valid 32 MiB padded ELF under a 64 MiB address-space limit, with successful public CLI/MCP controls under normal limits. It still requires a typed allocation failure, exact reported limit when available, complete diagnostics, and unchanged input bytes. Production deadlines and all failure assertions remain intact. Validation: `check:fast` and full `npm run check` passed; 61 focused tests passed across ownership, Go CLI/MCP, and session-snapshot regressions. Real bridge probes with the pinned Python packages passed on Python 3.12.3 and 3.12.14. Full local real-provider verification remains blocked by the container's procps/process-ownership boundary. GitHub's [real binary-layout lane](https://github.com/morluto/rea/actions/runs/38072037286/job/114271248654) now passes on this exact head: 151 public CLI/MCP cases, 4 bootstrap boundary cases, no target execution, and verified process lineage. The fresh real Go and recorded-crash lanes also pass. The broader CI workflow is still pending; full-suite success is not yet claimed. ### Earlier upstream sync — `7d35038` Merged upstream `main` at `0d899783` and resolved the README, CLI command inventory, MCP composition, and Vitest conflicts while preserving both Go metadata inspection and the newer upstream features. Authored Go skill guidance follows upstream's `.agents/skills/` relocation. Also reproduced and fixed an integration race: `inspect_go_binary` now uses the shared admitted Evidence handler, so a concurrently closing session includes the in-flight inspection in its saved snapshot. The new public MCP regression failed before the fix and passes afterward. Validation during this sync: - 151 focused tests passed across 10 files, including Go reader/service/CLI/MCP, snapshot replay, PE resources, and product catalog checks. - `npm run check`, `npm run docs:check`, and test discovery passed; all 772 test files are discovered exactly once. Final `check:fast` passed after incorporating the latest Android-only upstream change. - Real Go 1.26.1 verification passed for 10 compiler-produced binaries and 20 public CLI/MCP cases against Go's own reader. Local process-lineage observation remains unavailable. - The additional JADX integration attempt had 4 passes and 29 failures blocked by this container's process-ownership `ps` error (`fatal library error, lookup self`). This is an explicit verification limitation; no real JADX result is claimed. The merge commit's real Go lane passed. Its real binary-layout lane found the resource-limit/cleanup failure addressed by the follow-up above. Earlier verification below is historical and does not establish the current head's complete CI status. Adds `inspect_go_binary` and `rea inspect-go-binary PATH --json` for compiler version, modules, dependency replacements and ordered build settings embedded in a selected local binary. The built-in TypeScript reader requires no Go runtime. Inspection reads file bytes without executing the selected artifact, launching an analysis subprocess, changing the file or accessing the network. Go is used only to produce verification fixtures. ### Behavior - Reads ELF, PE and thin Mach-O: 32/64-bit images, applicable byte orders, Go 1.18+ inline strings and historical pointer encoding. - Uses producer-selected sections/mappings and virtual alignment. Preserves exact source offsets, SHA-256 artifact identity, compiler bytes, framed module bytes, duplicate settings, local replacements, empty fields and unfamiliar records. - Go strings may contain arbitrary bytes. Undecodable `go_version` / `module_text` are `null`, with exact bytes in base64. Decodable module records remain available; undecodable lines are retained in `unparsed_line_bytes_base64` and mark the module result incomplete. - Returns `build_info: null` when metadata is absent; absence does not prove a file is non-Go. Malformed files and unsupported containers retain distinct typed errors. - Integrates the target-free MCP contract, session Evidence, tool effects, CLI catalog, generated documentation inputs and skill guidance. - Rejects symlinks and changing file snapshots. Separate guards bound file reads to 256 MiB, embedded strings to 1 MiB, structural tables to 16 MiB and normalized reports to 8 MiB. MCP's response budget also applies. Universal Mach-O, XCOFF and Plan 9 remain outside this reader. Embedded supply-chain claims are observed content; this tool does not authenticate them or recover functions/types. ```bash rea inspect-go-binary ./application --json ``` ```json {"name":"inspect_go_binary","arguments":{"path":"/artifacts/application"}} ``` ### Bug review The follow-up review reproduced and fixed: - Rejection of valid non-UTF-8 compiler/settings strings produced by Go. - Validation of the unused inline pointer-width byte; pointer encoding still validates its width. - Acceptance of contradictory PE/Mach-O mappings, including overlaps covering only part of the metadata. - PE data-directory counts extending beyond the declared optional header. - Valid DOS/NE/LE/LX files receiving malformed-PE errors, and corrupt high-bit signatures being mistaken for old Windows formats. - Valid moduleless Go 1.17 binaries being rejected because their empty module header lives in zero-initialized memory outside the stored file bytes. The complete optional header must lie in declared zero-fill, without any conflicting file mapping; arbitrary unmapped pointers and compiler/string data stay strict. Empty-module source locations are documented zero-byte anchors at the original module-pointer field. - Initial symlink-loop (`ELOOP`) and overlong-path (`ENAMETOOLONG`) errors being misclassified as provider failures instead of invalid selected input. Post-validation replacement errors retain their artifact-changed classification. The real verifier now clears unrelated startup-target/cache-helper settings and fixes module mode. Each CLI diagnostic regression has its own unchanged test deadline. ### Earlier validation (before upstream sync) Earlier local checks on the pre-sync follow-up tree: - **134 tests passed**, zero failed: 130 Go tests across reader, mapping checks, module parser, provider, service, compiled CLI and MCP schemas/results, plus 4 shared stable-artifact tests. Zero-fill regressions include every supported width/byte-order layout, partial and full aliases, overflow, missing file bytes, `__PAGEZERO` exclusion and strict malformed pointer behavior. - `npm run test:prepare`, `npm run check:ci`, `npm run docs:check` and test discovery passed; all **705 test files** are assigned exactly once. Duplication checks retain the existing threshold. - **10 real Go 1.26.1 binaries / 20 public CLI and MCP cases** passed against Go's standard `debug/buildinfo` oracle: stripped ELF/PE/Mach-O, 32-bit images, big-endian ppc64, sectionless ELF, local replacement and compiler-produced arbitrary byte strings. Source bytes/digests/ranges and CLI/MCP equality are checked; inspected targets are never executed. - The real lane passed with deliberately unrelated startup-target/cache-helper values and ambient module mode disabled. Windows explicitly reports omission of the Unix byte-argument producer case. - Authentic **Go 1.17.13 pointer metadata** passed for **5 binaries / 10 public CLI and MCP cases**: the official moduleless `go`, `gofmt`, `compile` and `link` binaries, plus a module-bearing fixture with local replacement. Results agree with Go's reader, bind source spans/digests, preserve source bytes and match across CLI/MCP. Inspected targets were never executed. - Independent review of the fixes and real verifier completed. - Additional review probes passed: **20,000 Go-generated setting records**, including Unicode, escapes and byte-valued strings; **10,000 seeded parser mutations/truncations** across formats, widths, byte orders and encodings, with only typed failures and byte-exact valid source ranges; and **15 additional compiler-produced binaries / 30 CLI and MCP cases**. The real binaries cover modern PIE/shared-library/plugin output, legacy PIE/shared-library and PE/Mach-O output, s390x/MIPS/RISC-V, FreeBSD and Windows ARM64. These are one-off review probes, not additional committed CI tests. Earlier CI for follow-up commit `cbe413fd9b291d7a5f37c8fc78db482e3b62aec0` passed all four test shards and merged coverage: **6,417 tests passed / 89 skipped** across 712 discovered files (701 passed / 11 skipped). [Full-suite checks](https://github.com/morluto/rea/actions/runs/37995288878) and the [real Go lane](https://github.com/morluto/rea/actions/runs/37995289023) passed; the latter verified 10 binaries / 20 public cases with Go 1.26.1 and process lineage. Static checks, documentation, package build, both Linux native package lanes, the Windows package/capability lane and Apple artifact E2E also passed. **All 29 CI checks passed**, including both Darwin package lanes. Local process-lineage observations are explicitly unavailable on this host; the verifier does not claim OS isolation. The earlier incomplete local full-suite attempt is not counted as a passing gate. No dependency changes, compiled fixtures, generated output, SQLite changes or unrelated fixes are included. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:10:45 +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#2828
No description provided.