From f4987281fab32825501f6e7b1726c8e2fd2f25a8 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Mon, 26 Oct 2026 15:14:48 +0800 Subject: [PATCH] fix(setup): forward supported tool and runtime selections --- docs/client-configuration.md | 14 ++++-- .../SetupRegistrationEnvironment.ts | 27 +++++++++++ .../registrationRuntimeEnvironmentCli.test.ts | 46 ++++++++++++++++++- 3 files changed, 82 insertions(+), 5 deletions(-) diff --git a/docs/client-configuration.md b/docs/client-configuration.md index 4ed0c69e80..8f73e67240 100644 --- a/docs/client-configuration.md +++ b/docs/client-configuration.md @@ -247,11 +247,17 @@ duration. Setup preserves positive timeout values already in the `rea` entry. Setup also forwards explicitly selected input/output schema profiles, `REA_MCP_MAX_RESPONSE_BYTES`, provider paths and supported Ghidra, JADX and Kuna -settings. This includes the selected ADB, apktool, tshark, capinfos and tshark -prlimit executable paths. A provider being unavailable does not discard its selected paths; +settings. It also forwards explicit executable and resource selections for ADB, +apktool, packet capture, GDB/Rizin/objdump, Cutter, WABT, Wakaru, firmware and +signal tools, browser inspection, and pwntools/pwndbg. This includes their +supported prlimit overrides, Darwin Swift compiler/SDK/module-cache selections, +and compile timeout, logging level and explicitly configured reference-secret +patterns. A provider being unavailable does not discard its selected paths; doctor reports its readiness separately. Explicit selections override discovered -defaults. Unrelated environment variables are not copied, and existing client -environment overrides remain intact unless setup supplies the same key. +defaults, including when setup runs again with a changed selection. Unrelated +environment variables, process ownership tokens and one-shot target paths are not +copied. Existing client environment overrides remain intact unless setup supplies +the same key. You can edit `startupTimeoutMs` and `toolTimeoutMs` there; doctor keeps positive caller-selected values aligned and reports a non-blocking advisory when a tool timeout is shorter than the known provider allowance. diff --git a/src/application/SetupRegistrationEnvironment.ts b/src/application/SetupRegistrationEnvironment.ts index e29bba75d5..ccab5059e3 100644 --- a/src/application/SetupRegistrationEnvironment.ts +++ b/src/application/SetupRegistrationEnvironment.ts @@ -11,6 +11,33 @@ const SELECTED_REGISTRATION_SETTINGS = [ "REA_TSHARK_COMMAND", "REA_CAPINFOS_COMMAND", "REA_TSHARK_PRLIMIT_COMMAND", + "REA_OBJDUMP_COMMAND", + "REA_GDB_COMMAND", + "REA_RIZIN_COMMAND", + "REA_CUTTER_BRIDGE_DIR", + "REA_WABT_BIN_DIRECTORY", + "REA_WAKARU_COMMAND", + "REA_JAVASCRIPT_PRLIMIT_COMMAND", + "REA_BINWALK_COMMAND", + "REA_UNBLOB_COMMAND", + "REA_FIRMWARE_PRLIMIT_COMMAND", + "REA_EVM_PRLIMIT_COMMAND", + "REA_SIGROK_COMMAND", + "REA_SIGROK_PRLIMIT_COMMAND", + "REA_MITMDUMP_COMMAND", + "REA_BROWSER_EXECUTABLE", + "REA_BROWSER_NO_SANDBOX", + "REA_PWNTOOLS_PYTHON", + "REA_PWNTOOLS_MAX_INPUT_BYTES", + "REA_PWNDBG_GDB", + "REA_PWNDBG_GDBINIT", + "REA_PWNDBG_VENV_PATH", + "REA_DARWIN_SWIFTC_PATH", + "REA_DARWIN_MODULE_CACHE_PATH", + "SDKROOT", + "REA_SWIFTC_COMPILE_TIMEOUT_MS", + "REA_LOG_LEVEL", + "REA_REFERENCE_SECRET_PATTERNS_JSON", "REA_IDA_MCP_CONFIG", "REA_JADX_MCP_JAR", "REA_JADX_HEAP_MIB", diff --git a/tests/acceptance/setup/registrationRuntimeEnvironmentCli.test.ts b/tests/acceptance/setup/registrationRuntimeEnvironmentCli.test.ts index 5d6ee9566e..5acb176acc 100644 --- a/tests/acceptance/setup/registrationRuntimeEnvironmentCli.test.ts +++ b/tests/acceptance/setup/registrationRuntimeEnvironmentCli.test.ts @@ -36,6 +36,37 @@ cliTest( REA_TSHARK_COMMAND: join(home, "offline-tshark"), REA_CAPINFOS_COMMAND: join(home, "offline-capinfos"), REA_TSHARK_PRLIMIT_COMMAND: join(home, "offline-prlimit"), + REA_OBJDUMP_COMMAND: join(home, "offline-objdump"), + REA_GDB_COMMAND: join(home, "offline-gdb"), + REA_RIZIN_COMMAND: join(home, "offline-rizin"), + REA_CUTTER_BRIDGE_DIR: join(home, "cutter-bridge"), + REA_WABT_BIN_DIRECTORY: join(home, "wabt"), + REA_WAKARU_COMMAND: join(home, "offline-wakaru"), + REA_JAVASCRIPT_PRLIMIT_COMMAND: join(home, "javascript-prlimit"), + REA_BINWALK_COMMAND: join(home, "offline-binwalk"), + REA_UNBLOB_COMMAND: join(home, "offline-unblob"), + REA_FIRMWARE_PRLIMIT_COMMAND: join(home, "firmware-prlimit"), + REA_EVM_PRLIMIT_COMMAND: join(home, "evm-prlimit"), + REA_SIGROK_COMMAND: join(home, "offline-sigrok"), + REA_SIGROK_PRLIMIT_COMMAND: join(home, "sigrok-prlimit"), + REA_MITMDUMP_COMMAND: join(home, "offline-mitmdump"), + REA_BROWSER_EXECUTABLE: join(home, "offline-chromium"), + REA_BROWSER_NO_SANDBOX: "false", + REA_PWNTOOLS_PYTHON: join(home, "offline-python"), + REA_PWNTOOLS_MAX_INPUT_BYTES: "67108864", + REA_PWNDBG_GDB: join(home, "pwndbg-gdb"), + REA_PWNDBG_GDBINIT: join(home, "pwndbg-gdbinit"), + REA_PWNDBG_VENV_PATH: join(home, "pwndbg-venv"), + ...(process.platform === "darwin" + ? {} + : { + REA_DARWIN_SWIFTC_PATH: join(home, "offline-swiftc"), + REA_DARWIN_MODULE_CACHE_PATH: join(home, "swift-module-cache"), + SDKROOT: join(home, "macos-sdk"), + }), + REA_SWIFTC_COMPILE_TIMEOUT_MS: "180000", + REA_LOG_LEVEL: "warn", + REA_REFERENCE_SECRET_PATTERNS_JSON: '["explicit-private-value"]', REA_ANALYSIS_PROVIDER: "ghidra", REA_MCP_INPUT_SCHEMA_PROFILE: "compact", REA_MCP_OUTPUT_SCHEMA_PROFILE: "off", @@ -48,6 +79,9 @@ cliTest( ...selected, CALLER_UNRELATED_SETTING: "do not copy", REA_UNKNOWN_SETTING: "do not copy", + REA_PROCESS_RUN_ID: "do not copy", + REA_TOKEN: "do not copy", + HOPPER_TARGET_PATH: "do not copy", }; const run = () => cli.run({ @@ -69,13 +103,23 @@ cliTest( mcpServers: { rea: { env: selected } }, }); expect(configured).not.toContain("do not copy"); + // A later setup must update a selection rather than retaining the first value. + selected.REA_OBJDUMP_COMMAND = join(home, "replacement-objdump"); + environment.REA_OBJDUMP_COMMAND = selected.REA_OBJDUMP_COMMAND; + const updated = await run(); + expect(updated.exitCode, updated.stdout).toBe(0); + const updatedConfiguration = await readFile(config, "utf8"); + expect(JSON.parse(updatedConfiguration)).toMatchObject({ + mcpServers: { rea: { env: selected } }, + }); + expect(updatedConfiguration).not.toContain("do not copy"); const repeated = await run(); expect(repeated.exitCode, repeated.stdout).toBe(0); expect(repeated.json).toMatchObject({ plannedActions: [], appliedActions: [], }); - expect(await readFile(config, "utf8")).toBe(configured); + expect(await readFile(config, "utf8")).toBe(updatedConfiguration); }, );