diff --git a/docs/reverse-engineering-tools.md b/docs/reverse-engineering-tools.md index e0da47fd10..dc350efcbc 100644 --- a/docs/reverse-engineering-tools.md +++ b/docs/reverse-engineering-tools.md @@ -109,14 +109,11 @@ where `stdout_invalid_utf8` and `stderr_invalid_utf8` mark output that was not valid UTF-8 and so holds replacement characters. Each call's lookup, hash and probe use that call's `command_timeout_ms` budget and cancellation; a lookup or hash that reaches the deadline ends the call -without running the command. For each resolved path, REA keeps the latest -probe whose outcome describes the file (a banner, a non-zero exit, termination -by a signal, or output that is not valid UTF-8) for the life of the server -process and reuses it while the SHA-256 matches. A new SHA-256 replaces it, and -a later failure never replaces a successful reading of the same file. A probe -that timed out is not reused, because its timeout reflects only that call's -deadline; neither is a cancelled probe or one whose output was not fully -collected. +without running the command. REA probes before every command and reuses no +reading: a launcher, such as a version-manager shim, keeps its path and SHA-256 +while the tool it runs changes, so only the call's own probe describes the tool +that answers. Each call therefore launches the executable twice, the probe and +then the command. Captured stdout and stderr are retained up to a 16 MiB combined limit; `output_truncated` marks output beyond that limit. One-shot commands use the `command_timeout_ms` budget described above. That 16 MiB cap has no runtime override. A typed failure's `captured_output` marks a stream that held invalid UTF-8 with `stdout_invalid_utf8` or `stderr_invalid_utf8`. diff --git a/src/application/reverse/ReverseEngineeringService.ts b/src/application/reverse/ReverseEngineeringService.ts index 52e2a2c33e..d6f0ce0936 100644 --- a/src/application/reverse/ReverseEngineeringService.ts +++ b/src/application/reverse/ReverseEngineeringService.ts @@ -152,16 +152,6 @@ export class ReverseEngineeringService { AbortController, Promise> >(); - /** - * The latest completed version probe for each resolved launch path, with - * the digest of the file it read; a new digest replaces the entry, and a - * kept banner is bounded. Cancelled probes, probes whose output was not - * collected and probes whose cleanup is incomplete are not kept. - */ - readonly #versionProbes = new Map< - string, - { readonly sha256: string; readonly completed: KeptVersionProbe } - >(); #closing = false; #closePromise: Promise | undefined; @@ -868,7 +858,8 @@ export class ReverseEngineeringService { /** * Resolve, hash and identify the selected executable, then run that same - * path. A completed probe is reused for the same launch path and digest. A + * path. Every call probes, in its environment and under its deadline: a + * launcher keeps its path and digest while the tool it runs can change. A * tool that cannot be identified still runs; only cancellation, the call's * deadline and a probe whose process cleanup remains incomplete stop the * command. @@ -948,22 +939,16 @@ export class ReverseEngineeringService { provider_executable_path: lookup.path, provider_executable_sha256: sha256, }; - const kept = this.#versionProbes.get(lookup.path); - let completed: VersionProbeOutcome | undefined = - kept?.sha256 === sha256 ? kept.completed : undefined; - if (completed === undefined) { - const outcome = await this.#runVersionProbe( - operation, - lookup.path, - probe, - environment, - signal, - timeoutMs, - ); - if (!outcome.ok) return outcome; - completed = outcome.value; - this.#rememberVersionProbe(lookup.path, sha256, completed); - } + const outcome = await this.#runVersionProbe( + operation, + lookup.path, + probe, + environment, + signal, + timeoutMs, + ); + if (!outcome.ok) return outcome; + const completed = outcome.value; if (completed.status !== "read") return ok( unidentified( @@ -998,29 +983,6 @@ export class ReverseEngineeringService { }); } - /** - * Keep an outcome scoped to the executable as its launch path's latest probe; - * a new digest replaces it. Concurrent first calls can each probe the same - * digest, so a later failure never replaces a successful reading of it; a - * success replaces an earlier failure. Outcomes scoped to one call are not - * kept. - */ - #rememberVersionProbe( - path: string, - sha256: string, - outcome: VersionProbeOutcome, - ): void { - if (outcome.scope !== "executable") return; - const kept = this.#versionProbes.get(path); - if ( - outcome.status !== "read" && - kept?.sha256 === sha256 && - kept.completed.status === "read" - ) - return; - this.#versionProbes.set(path, { sha256, completed: outcome }); - } - /** * Run one version probe under the call's deadline and cancellation. Its * output stays separate from the command's; a failed probe keeps bounded @@ -1046,14 +1008,12 @@ export class ReverseEngineeringService { // identifies nothing. if (output.stdoutInvalidUtf8 === true) return ok({ - scope: "executable", status: "undecodable", diagnostics: versionProbeDiagnostics(0, output), }); const line = output.stdout.split(/\r?\n/u, 1)[0]?.trim() ?? ""; const banner = line.slice(0, VERSION_PROBE_TEXT_CHARS); return ok({ - scope: "executable", status: "read", identification: probe.identify(banner), banner, @@ -1095,19 +1055,12 @@ export class ReverseEngineeringService { cleanupOwner, ), ); - const diagnostics = versionProbeDiagnostics(code, capture); - // Only an exit or the call's deadline completes a probe. A launch - // failure, or output that was not fully collected, is not a reading of - // this executable, whatever its exit status. - return ok( - capture?.collectionFailure === true - ? { scope: "call", status: "unfinished", diagnostics } - : code === "ETIMEDOUT" - ? { scope: "call", status: "timed-out", diagnostics } - : typeof code === "number" || capture?.signal != null - ? { scope: "executable", status: "failed", diagnostics } - : { scope: "call", status: "unfinished", diagnostics }, - ); + // Both runners report the call's deadline as ETIMEDOUT, even when the + // stop signal also ended the process. + return ok({ + status: code === "ETIMEDOUT" ? "timed-out" : "failed", + diagnostics: versionProbeDiagnostics(code, capture), + }); } } @@ -1129,15 +1082,9 @@ interface ProviderIdentification { readonly parameters: Readonly>; } -/** - * One version probe's outcome. An outcome scoped to the executable is a fact - * about that file and is kept for its launch path and digest. One scoped to - * the call is not kept: a timeout reflects that call's command_timeout_ms, and - * unfinished output was not read. - */ +/** One version probe's outcome. */ type VersionProbeOutcome = | { - readonly scope: "executable"; readonly status: "read"; /** Undefined when the banner identified no tool. */ readonly identification: ProviderToolIdentification | undefined; @@ -1146,33 +1093,22 @@ type VersionProbeOutcome = readonly bannerTruncated: boolean; } | { - readonly scope: "executable"; - readonly status: "failed" | "undecodable"; - readonly diagnostics: Readonly>; - } - | { - readonly scope: "call"; - readonly status: "timed-out" | "unfinished"; + readonly status: "failed" | "timed-out" | "undecodable"; readonly diagnostics: Readonly>; }; -type KeptVersionProbe = Extract< - VersionProbeOutcome, - { readonly scope: "executable" } ->; /** Why a probe that read no usable banner leaves the version unknown. */ export const VERSION_PROBE_FAILURE_REASONS = { failed: "did not complete successfully", "timed-out": "reached the command deadline", undecodable: "printed output that is not valid UTF-8", - unfinished: "did not complete successfully", } as const satisfies Record< Exclude, string >; // A banner is one line; this bounds the banner a probe keeps and a failed -// probe's diagnostics, so both stay small in Evidence and in the probe cache. +// probe's diagnostics, so both stay small in Evidence. const VERSION_PROBE_TEXT_CHARS = 2_048; /** Bounded exit facts and output of a probe that printed no usable banner. */ diff --git a/src/contracts/reverseEngineeringToolContracts.ts b/src/contracts/reverseEngineeringToolContracts.ts index 40db8e0d89..8021b01c72 100644 --- a/src/contracts/reverseEngineeringToolContracts.ts +++ b/src/contracts/reverseEngineeringToolContracts.ts @@ -39,7 +39,7 @@ export const REVERSE_ENGINEERING_TOOL_CONTRACTS = [ ...toolContractMetadata("execute_rizin_command"), kind: "native-provider", description: - "Execute one caller-selected Rizin command against a local artifact using the Rizin CLI profile that suppresses user settings and scripts while retaining plugins. Preserves decoded stdout and stderr inline with SHA-256 Evidence, up to a shared 16 MiB combined limit; invalid UTF-8 bytes are represented by replacement characters and flagged in Evidence limitations. output_truncated reports output beyond that limit and completion_status is unknown if buffer enforcement terminated the process. Rizin commands and retained plugins can execute foreign code, mutate files, access the network, and read files outside the selected artifact; identities and contents of those external inputs are not bound to Evidence. Command effects depend on the Rizin command and loaded plugins; JSON is command-specific and raw output remains authoritative. Before the first command for each resolved executable path and digest, REA also launches the selected executable with -v; provider.name and provider.version come from that banner and can name another tool, such as radare2, that REA_RIZIN_COMMAND selected; without an identifying banner they are assumed (provider_identity). In a shared MCP server, this admitted command closes any active binary-analysis session; after its effects have settled, call open_binary before further analysis. Close an active Ghidra session explicitly first. Optional command_timeout_ms is the per-phase wall clock in milliseconds (default 120000, range 1..2147483647); omitted means 120000 and the value applies on the next call. It does not raise the 16 MiB output cap or a Rizin debugger session deadline.", + "Execute one caller-selected Rizin command against a local artifact using the Rizin CLI profile that suppresses user settings and scripts while retaining plugins. Preserves decoded stdout and stderr inline with SHA-256 Evidence, up to a shared 16 MiB combined limit; invalid UTF-8 bytes are represented by replacement characters and flagged in Evidence limitations. output_truncated reports output beyond that limit and completion_status is unknown if buffer enforcement terminated the process. Rizin commands and retained plugins can execute foreign code, mutate files, access the network, and read files outside the selected artifact; identities and contents of those external inputs are not bound to Evidence. Command effects depend on the Rizin command and loaded plugins; JSON is command-specific and raw output remains authoritative. Before each command, REA also launches the selected executable with -v; provider.name and provider.version come from that banner and can name another tool, such as radare2, that REA_RIZIN_COMMAND selected; without an identifying banner they are assumed (provider_identity). In a shared MCP server, this admitted command closes any active binary-analysis session; after its effects have settled, call open_binary before further analysis. Close an active Ghidra session explicitly first. Optional command_timeout_ms is the per-phase wall clock in milliseconds (default 120000, range 1..2147483647); omitted means 120000 and the value applies on the next call. It does not raise the 16 MiB output cap or a Rizin debugger session deadline.", inputSchema: rizinInputSchema, outputSchema: evidenceResultOf(commandObservationSchema), examples: [ diff --git a/src/rizin/RizinCommand.ts b/src/rizin/RizinCommand.ts index c90a4fb707..418da8d856 100644 --- a/src/rizin/RizinCommand.ts +++ b/src/rizin/RizinCommand.ts @@ -37,7 +37,7 @@ export const identifyRizinTool = ( }; }; -/** Identify the selected tool; the service reuses a completed probe per launch path and digest. */ +/** Identify the selected tool; the service probes before every command. */ export const RIZIN_VERSION_PROBE: ProviderVersionProbe = { arguments: ["-v"], identify: identifyRizinTool, diff --git a/tests/composition/reverseEngineeringToolIdentity.test.ts b/tests/composition/reverseEngineeringToolIdentity.test.ts index 05f5bfde4b..22abc67f1c 100644 --- a/tests/composition/reverseEngineeringToolIdentity.test.ts +++ b/tests/composition/reverseEngineeringToolIdentity.test.ts @@ -85,7 +85,7 @@ const gate = () => { const posix = it.skipIf(process.platform === "win32"); posix( - "records the version from the banner, runs the path it hashed, and probes once per path and digest", + "records the version from the banner and probes the path it hashed before every command", async () => { const { executable, path, digest } = await fixture(); // Homebrew's Rizin 0.9.1 printed this banner, package suffix included. @@ -117,14 +117,20 @@ posix( provider_identity: "banner", }); } - expect(probes(run)).toBe(1); - // The probe and both commands spawn the resolved path, within the budget. - expect(run.mock.calls.map(([command]) => command)).toEqual([ - executable, - executable, - executable, + // Each call probes, then runs its command, both from the resolved path + // and within the call's budget. + expect( + run.mock.calls.map(([command, args, options]) => [ + command, + args[0] === "-v" ? "-v" : args.at(-2), + options?.timeout, + ]), + ).toEqual([ + [executable, "-v", 4_321], + [executable, "iI", 4_321], + [executable, "-v", 4_321], + [executable, "iS", 4_321], ]); - expect(run.mock.calls[0]?.[2]?.timeout).toBe(4_321); await writeFile(executable, "#!/bin/sh\nexit 1\n"); const changed = await service.executeRizinCommand({ path, command: "iI" }); @@ -132,7 +138,7 @@ posix( expect(changed.value.parameters.provider_executable_sha256).toBe( await digest(), ); - expect(probes(run)).toBe(2); + expect(probes(run)).toBe(3); }, ); @@ -228,7 +234,7 @@ posix.each([ ); posix( - "keeps a failed probe's exit and output, runs the command, and reuses that result", + "keeps a failed probe's exit and output and still runs the command", async () => { const { executable, path } = await fixture(); const run = vi.fn( @@ -277,215 +283,10 @@ posix( stdout: "command output", }); } - expect(probes(run)).toBe(1); + expect(probes(run)).toBe(2); }, ); -posix( - "runs each caller's probe under its own deadline and cancellation", - async () => { - const { executable, path } = await fixture(); - const firstStarted = gate(); - const secondStarted = gate(); - const release = gate(); - const run = vi.fn( - async ( - _command: string, - args: readonly string[], - options?: ExecFileOutputOptions, - ) => { - if (args[0] !== "-v") return { stdout: "command output", stderr: "" }; - (probes(run) === 1 ? firstStarted : secondStarted).open(); - const signal = options?.signal; - const aborted = new Promise<"aborted">((resolve) => { - if (signal?.aborted === true) resolve("aborted"); - signal?.addEventListener("abort", () => resolve("aborted"), { - once: true, - }); - }); - if ((await Promise.race([release.opened, aborted])) === "aborted") - throw Object.assign(new Error("aborted"), { code: "ABORT_ERR" }); - return { stdout: "rizin 0.9.1 @ linux-x86-64", stderr: "" }; - }, - ); - const service = new TestReverseEngineeringService({ - run, - lookup: lookupExecutable, - environment: { REA_RIZIN_COMMAND: executable }, - }); - const leaving = new AbortController(); - const pending: Promise[] = []; - try { - const first = service.executeRizinCommand( - { path, command: "iI", command_timeout_ms: 1_234 }, - { signal: leaving.signal }, - ); - pending.push(first); - await awaitAcknowledgement(firstStarted.opened, first, "first probe"); - const second = service.executeRizinCommand({ - path, - command: "iS", - command_timeout_ms: 5_678, - }); - pending.push(second); - await awaitAcknowledgement(secondStarted.opened, second, "second probe"); - leaving.abort("first caller left"); - const left = await within(first, "cancelled first call"); - if (left.ok) throw new Error("Expected the first caller to be cancelled"); - expect(left.error._tag).toBe("AnalysisCancelledError"); - expect(left.error.cause).toBe("first caller left"); - release.open(); - const kept = await within(second, "second call"); - if (!kept.ok) throw kept.error; - expect(kept.value.provider.version).toBe("0.9.1"); - const probeCalls = run.mock.calls.filter(([, args]) => args[0] === "-v"); - expect(probeCalls.map(([, , options]) => options?.timeout)).toEqual([ - 1_234, 5_678, - ]); - expect(probeCalls[0]?.[2]?.signal).not.toBe(probeCalls[1]?.[2]?.signal); - // The completed probe is reused; the cancelled one was never kept. - const reused = await within( - service.executeRizinCommand({ path, command: "iz" }), - "reusing call", - ); - if (!reused.ok) throw reused.error; - expect(probes(run)).toBe(2); - } finally { - release.open(); - leaving.abort("test cleanup"); - await Promise.allSettled(pending); - await service.close(); - } - }, -); - -posix.each([ - { first: "success", second: "timeout" }, - { first: "exit", second: "success" }, -] as const)( - "keeps the successful reading when concurrent probes end in $first then $second", - async ({ first: firstEnds, second: secondEnds }) => { - const { executable, path } = await fixture(); - const started = [gate(), gate()] as const; - const release = [gate(), gate()] as const; - const ends = [firstEnds, secondEnds] as const; - const run = vi.fn( - async ( - _command: string, - args: readonly string[], - _options?: ExecFileOutputOptions, - ) => { - if (args[0] !== "-v") return { stdout: "command output", stderr: "" }; - const index = probes(run) === 1 ? 0 : 1; - started[index].open(); - await release[index].opened; - if (ends[index] === "success") - return { stdout: "rizin 0.9.1 @ linux-x86-64", stderr: "" }; - throw Object.assign( - new Error("probe failed"), - ends[index] === "timeout" - ? { code: "ETIMEDOUT", signal: "SIGTERM", stdout: "", stderr: "" } - : { code: 2, signal: null, stdout: "", stderr: "usage\n" }, - ); - }, - ); - const service = new TestReverseEngineeringService({ - run, - lookup: lookupExecutable, - environment: { REA_RIZIN_COMMAND: executable }, - }); - const pending: Promise[] = []; - try { - const first = service.executeRizinCommand({ path, command: "iI" }); - pending.push(first); - await awaitAcknowledgement(started[0].opened, first, "first probe"); - const second = service.executeRizinCommand({ path, command: "iS" }); - pending.push(second); - await awaitAcknowledgement(started[1].opened, second, "second probe"); - // Each call reports its own probe, in the order the probes end. - for (const [index, call] of [first, second].entries()) { - release[index]?.open(); - const result = await within(call, `call ${String(index + 1)}`); - if (!result.ok) throw result.error; - expect(result.value.provider.version).toBe( - ends[index] === "success" ? "0.9.1" : null, - ); - } - const later = await within( - service.executeRizinCommand({ path, command: "iz" }), - "later call", - ); - if (!later.ok) throw later.error; - expect(later.value.provider).toEqual({ - id: "rizin", - name: "Rizin", - version: "0.9.1", - }); - expect(probes(run)).toBe(2); - } finally { - for (const each of release) each.open(); - await Promise.allSettled(pending); - await service.close(); - } - }, -); - -posix("keys completed probes by launch path as well as digest", async () => { - const { executable, path } = await fixture(); - const other = join(dirname(executable), "other"); - await mkdir(other); - const twin = join(other, "rizin"); - await writeFile(twin, await readFile(executable), { mode: 0o755 }); - const run = vi.fn( - async ( - command: string, - args: readonly string[], - _options?: ExecFileOutputOptions, - ) => ({ - stdout: - args[0] !== "-v" - ? "command output" - : command === twin - ? "rizin 0.8.0 @ linux-x86-64" - : "rizin 0.9.1 @ linux-x86-64", - stderr: "", - }), - ); - // One service, so its cache spans the calls; each call selects a launcher. - let selected = executable; - const service = new TestReverseEngineeringService({ - run, - lookup: lookupExecutable, - commands: { - objdump: (input) => - createReverseEngineeringCommandPort({}).objdump(input), - rizin: (input) => - createReverseEngineeringCommandPort({ - REA_RIZIN_COMMAND: selected, - }).rizin(input), - }, - }); - const versions: unknown[] = []; - try { - for (const launcher of [executable, twin, executable]) { - selected = launcher; - const result = await service.executeRizinCommand({ path, command: "iI" }); - if (!result.ok) throw result.error; - versions.push(result.value.provider.version); - } - } finally { - await service.close(); - } - expect(versions).toEqual(["0.9.1", "0.8.0", "0.9.1"]); - // Byte-identical launchers in different directories are probed apart, and - // each launcher's completed probe is reused. - expect( - run.mock.calls - .filter(([, args]) => args[0] === "-v") - .map(([command]) => command), - ).toEqual([executable, twin]); -}); - posix.each(["cancellation", "deadline"] as const)( "stops a stalled executable lookup on its %s without running anything", async (interruption) => { @@ -678,32 +479,6 @@ posix( }, ); -posix( - "keeps one completed probe per launch path and replaces it when the digest changes", - async () => { - const { executable, path } = await fixture(); - const original = await readFile(executable); - const run = runner(() => "rizin 0.9.1 @ linux-x86-64"); - const service = new TestReverseEngineeringService({ - run, - lookup: lookupExecutable, - environment: { REA_RIZIN_COMMAND: executable }, - }); - const call = async () => { - const result = await service.executeRizinCommand({ path, command: "iI" }); - if (!result.ok) throw result.error; - }; - await call(); - await writeFile(executable, "#!/bin/sh\nexit 1\n"); - await call(); - // The first file's reading was replaced, so the restored file is probed again. - await writeFile(executable, original); - await call(); - await call(); - expect(probes(run)).toBe(3); - }, -); - posix( "keeps at most 2,048 characters of a banner and marks it truncated", async () => { @@ -715,7 +490,6 @@ posix( lookup: lookupExecutable, environment: { REA_RIZIN_COMMAND: executable }, }); - // The second call reads the kept probe, which holds the bounded banner. for (const command of ["iI", "iS"]) { const result = await service.executeRizinCommand({ path, command }); if (!result.ok) throw result.error; @@ -725,7 +499,7 @@ posix( provider_version_banner_truncated: true, }); } - expect(probes(run)).toBe(1); + expect(probes(run)).toBe(2); }, ); @@ -778,7 +552,7 @@ posix( ); posix( - "probes again after a probe whose output was not fully collected", + "reports no exit status for a probe whose output was not fully collected", async () => { const { executable, path } = await fixture(); const bannerOutput = { @@ -788,21 +562,17 @@ posix( observedBytes: 26, }, }; - let probeCount = 0; const runOwned = vi.fn( async (request: { readonly arguments: readonly string[] }) => { if (request.arguments[0] !== "-v") return providerSnapshot(); - probeCount += 1; // The probe exits 0, but its output was not fully collected. - if (probeCount === 1) - throw new OwnedCommandFailure( - "process", - "Provider output collection failed.", - providerSnapshot(bannerOutput), - null, - { collectionFailure: true }, - ); - return providerSnapshot(bannerOutput); + throw new OwnedCommandFailure( + "process", + "Provider output collection failed.", + providerSnapshot(bannerOutput), + null, + { collectionFailure: true }, + ); }, ); const service = new TestReverseEngineeringService({ @@ -816,65 +586,6 @@ posix( expect(first.value.parameters.provider_version_probe).toMatchObject({ exit_code: null, }); - const second = await service.executeRizinCommand({ path, command: "iI" }); - if (!second.ok) throw second.error; - expect(second.value.provider.version).toBe("0.9.1"); - expect(probeCount).toBe(2); - }, -); - -posix( - "probes again under a later call's deadline after a probe timed out", - async () => { - const { executable, path } = await fixture(); - const probeDeadlines: (number | null)[] = []; - const runOwned = vi.fn( - async ( - request: { readonly arguments: readonly string[] }, - limits: { readonly timeoutMs: number | null }, - ) => { - if (request.arguments[0] !== "-v") return providerSnapshot(); - probeDeadlines.push(limits.timeoutMs); - // The first call's deadline stops the probe, which exits by its stop signal. - if (probeDeadlines.length === 1) - throw new OwnedCommandFailure( - "timeout", - "Command deadline elapsed.", - providerSnapshot({ exitCode: null, signal: "SIGTERM" }), - ); - return providerSnapshot({ - stdout: { - text: "rizin 0.9.1 @ linux-x86-64", - bytes: 26, - observedBytes: 26, - }, - }); - }, - ); - const service = new TestReverseEngineeringService({ - runOwned, - lookup: lookupExecutable, - environment: { REA_RIZIN_COMMAND: executable }, - }); - const short = await service.executeRizinCommand({ - path, - command: "iI", - command_timeout_ms: 100, - }); - if (!short.ok) throw short.error; - expect(short.value.provider.version).toBeNull(); - expect(short.value.parameters.provider_version_probe).toMatchObject({ - error_code: "ETIMEDOUT", - signal: "SIGTERM", - }); - const long = await service.executeRizinCommand({ - path, - command: "iI", - command_timeout_ms: 5_000, - }); - if (!long.ok) throw long.error; - expect(long.value.provider.version).toBe("0.9.1"); - expect(probeDeadlines).toEqual([100, 5_000]); }, ); @@ -1003,3 +714,31 @@ posix.each(["cancelled", "cleanup-incomplete"] as const)( expect(await service.retryCleanup()).toEqual({ ok: true, value: null }); }, ); + +posix( + "identifies the tool a launcher runs on each call, though the launcher's digest stays the same", + async () => { + const { executable, path, digest } = await fixture(); + // A version-manager shim: the same file delegates to whichever tool is selected. + const banners = [ + "rizin 0.9.1 @ linux-x86-64", + "rizin 0.8.1 @ linux-x86-64", + ]; + const run = runner(() => banners[probes(run) - 1] ?? "unexpected probe"); + const service = new TestReverseEngineeringService({ + run, + lookup: lookupExecutable, + environment: { REA_RIZIN_COMMAND: executable }, + }); + const versions: (string | null)[] = []; + const digests: unknown[] = []; + for (const command of ["iI", "iS"]) { + const result = await service.executeRizinCommand({ path, command }); + if (!result.ok) throw result.error; + versions.push(result.value.provider.version); + digests.push(result.value.parameters.provider_executable_sha256); + } + expect(versions).toEqual(["0.9.1", "0.8.1"]); + expect(digests).toEqual([await digest(), await digest()]); + }, +);