From bbd4989654f9d68783ca425ec3b2844f3ce77e22 Mon Sep 17 00:00:00 2001 From: Hasan Zayni <36798269+dark13b@users.noreply.github.com> Date: Thu, 29 Oct 2026 02:56:50 +0300 Subject: [PATCH] fix(config): treat a blank analyzer override as absent beside an existing Ghidra project (#7923) REA_GHIDRA_DISABLED_ANALYZERS parses a blank or comma-only value to no override, but the existing-project conflict check tested the raw value. MCP startup exited and doctor reported config_drift for an input that selects nothing. The check now uses the parsed value. Fixes #7422 --- src/config/environment.ts | 8 +++++++- .../ghidra/ghidraProjectSnapshot.test.ts | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/config/environment.ts b/src/config/environment.ts index fbc771dbea..672f77709b 100644 --- a/src/config/environment.ts +++ b/src/config/environment.ts @@ -236,7 +236,13 @@ export const parseEnvironment = ( "REA_GHIDRA_SEED_FILE", "REA_GHIDRA_DISABLED_ANALYZERS", "REA_GHIDRA_NATIVEAOT_JAR", - ].filter((setting) => environment[setting] !== undefined); + ].filter( + (setting) => + // Blank analyzer lists parse to no override, so they cannot conflict. + (setting === "REA_GHIDRA_DISABLED_ANALYZERS" + ? env[setting] + : environment[setting]) !== undefined, + ); if (incompatible.length > 0) return err( new ConfigurationError("Invalid existing Ghidra project configuration", { diff --git a/tests/boundary/providers/ghidra/ghidraProjectSnapshot.test.ts b/tests/boundary/providers/ghidra/ghidraProjectSnapshot.test.ts index d429cbf689..1f1e0a0033 100644 --- a/tests/boundary/providers/ghidra/ghidraProjectSnapshot.test.ts +++ b/tests/boundary/providers/ghidra/ghidraProjectSnapshot.test.ts @@ -114,6 +114,22 @@ it("parses an opt-in project once for shared CLI/MCP configuration and rejects i ); }); +it("accepts a blank analyzer override beside an existing project and rejects a named one", () => { + const environment = { + REA_GHIDRA_PROJECT_PATH: join(process.cwd(), "existing.gpr"), + }; + for (const blank of ["", " ", ", ,"]) + expect( + parseConfig({ ...environment, REA_GHIDRA_DISABLED_ANALYZERS: blank }).ok, + ).toBe(true); + expect( + parseConfig({ + ...environment, + REA_GHIDRA_DISABLED_ANALYZERS: "Decompiler Parameter ID", + }).ok, + ).toBe(false); +}); + it("reports an invalid derived program name at its selection boundary", async () => { const { source } = await fixture(); await expect(